//
//  PersonalityView.m
//  yonghu
//
//  Created by 浪尖渝力 on 2018/1/18.
//  Copyright © 2018年 com.DJS. All rights reserved.
//

#import "PersonalityView.h"
#import "SelectDocumentView.h"
#import "PayView2Controller.h"
#import "selectRegionView.h"
#import "PingJiaViewController.h"
#import "OKViewController.h"
#import "WEBViewController.h"
@implementation PersonalityView{
    NSURLSessionDownloadTask *_downloadTask;
}
-(void)creatView{
    self.backgroundColor=_LightGrey;
    _xieYi=YES;
    _scrollView=[UIScrollView new];
    [self addSubview:_scrollView];
    [_scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(0);
        make.left.right.mas_equalTo(0);
        make.bottom.mas_equalTo(0);
    }];
    _scrollView.scrollsToTop =NO;
    
    _scrollView.showsVerticalScrollIndicator = FALSE;
    _scrollView.showsHorizontalScrollIndicator = FALSE;
    _scrollView.bounces = NO;
    if (@available(iOS 11.0, *)) {
        self.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
    } else {
        self.viewController.automaticallyAdjustsScrollViewInsets = NO;
    }
    
    
    UIView *topView=[UIView new];
    [_scrollView addSubview:topView];
    [topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.mas_equalTo(NAV_HEIGHT);
        make.width.mas_equalTo(_mainW);
        make.height.mas_equalTo(120);
    }];
    [self creatTopView:topView];
    if (_dic==nil) {
        [self creatXieWenShu];
    }
    if (_dic!=nil) {
        NSNumber *document_status=[_dic objectForKey:@"document_status"];
        if (document_status.integerValue==0) {
            [self LvSiFuWu];
        }if (document_status.integerValue==1) {
            [self pingJiaView];
            
            UIButton *btn1=[UIButton new];
            [self addSubview:btn1];
            [btn1 mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.mas_equalTo(0);
                make.width.mas_equalTo(_mainW);
                make.height.mas_equalTo(50);
                make.bottom.mas_equalTo(0);
            }];
            [btn1 setTitle:@"立即评价" forState:0];
            [btn1 setTitleColor:[UIColor whiteColor] forState:0];
            btn1.backgroundColor=_backgroundColor;
            [btn1 addTarget:self action:@selector(pijiama:) forControlEvents:UIControlEventTouchUpInside];
        }
        if (document_status.integerValue==2) {
            
            [self wanChengView];
        }
    }
    
    
}
-(void)creatTopView:(UIView *)topView{
    UIView *xianView=[UIView new];
    [topView addSubview:xianView];
    [xianView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(25);
        make.right.mas_equalTo(-25);
        make.top.mas_equalTo(35);
        make.height.mas_equalTo(1.5);
    }];
    xianView.backgroundColor=ColorWithRGB(200, 200, 201);
    
    NSArray *arr=[NSArray arrayWithObjects:@"发布需求",@"律师服务",@"评价",@"完成", nil];
    int index=0;
    if (_dic!=nil) {
        NSNumber *document_status=[_dic objectForKey:@"document_status"];
        index=document_status.intValue+1;
    }
    for (int i=0; i<arr.count; i++) {
        UIImageView *imageView=[UIImageView new];
        [topView addSubview:imageView];
        [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(((_mainW-70)/3)*i+25);
            make.centerY.mas_equalTo(xianView);
            if (i==index) {
                make.width.height.mas_equalTo(33);
            }
            else{
                make.width.height.mas_equalTo(25);
            }
        }];
        if (i>index) {
            imageView.image=[UIImage imageNamed:@"圆-1"];
        }
        else if (index==i) {
            imageView.image=[UIImage imageNamed:@"圆3"];
        }
        else if (index>i){
            imageView.image=[UIImage imageNamed:@"圆2"];
        }
        
        UILabel *label=[UILabel new];
        [topView addSubview:label];
        [label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.mas_equalTo(imageView);
            make.bottom.mas_equalTo(-20);
        }];
        label.text=arr[i];
        if (index==i) {
            label.textColor=_backgroundColor;
            label.font=[UIFont systemFontOfSize:18];
        }
        else{
            label.textColor=ColorWithRGB(149, 149, 149);
            label.font=[UIFont systemFontOfSize:15];
        }
    }
}
-(void)creatXieWenShu{
    UIView *topView=[UIView new];
    [_scrollView addSubview:topView];
    [topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.width.mas_equalTo(_mainW-10);
        make.height.mas_equalTo(400);
        make.top.mas_equalTo(190);
    }];
    topView.backgroundColor=[UIColor whiteColor];
    topView.layer.cornerRadius=3;
    
    UIView *leiXinView=[UIView new];
    [topView addSubview:leiXinView];
    [leiXinView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.left.top.mas_equalTo(0);
        make.height.mas_equalTo(55);
    }];
    
    leiXinView.userInteractionEnabled=YES;
    UITapGestureRecognizer *tuiChuView = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(SelectDocument:)];
    [leiXinView addGestureRecognizer:tuiChuView];
    
    
    UIImageView *nameImage=[UIImageView new];
    [leiXinView addSubview:nameImage];
    [nameImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(10);
        make.width.mas_equalTo(15);
        make.height.mas_equalTo(20);
    }];
    nameImage.image=[UIImage imageNamed:@"案件类型"];
    
    UILabel *nameLabel=[UILabel new];
    [leiXinView addSubview:nameLabel];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(nameImage.mas_right).mas_equalTo(10);
        make.centerY.mas_equalTo(0);
    }];
    nameLabel.font=[UIFont systemFontOfSize:17];
    nameLabel.text=@"文书类型";
    nameLabel.textColor=ColorWithRGB(49, 49, 49);
    
    
    
    UIImageView *imgaeView=[UIImageView new];
    [leiXinView addSubview:imgaeView];
    [imgaeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(0);
        make.width.mas_equalTo(12);
        make.height.mas_equalTo(20);
    }];
    imgaeView.image=[UIImage imageNamed:@"iconfont-fanhui-拷贝-3"];
    
    _leiXinLabel=[UILabel new];
    [leiXinView addSubview:_leiXinLabel];
    [_leiXinLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(imgaeView.mas_left).mas_equalTo(-5);
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(150);
    }];
    _leiXinLabel.textAlignment=NSTextAlignmentRight;
    _leiXinLabel.text=@"";
    _leiXinLabel.font=[UIFont systemFontOfSize:15];
    _leiXinLabel.textColor=ColorWithRGB(49, 49, 49);
    
    UIView *xianView=[UIView new];
    [topView addSubview:xianView];
    [xianView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.top.mas_equalTo(55);
        make.right.mas_equalTo(-5);
        make.height.mas_equalTo(1);
    }];
    xianView.backgroundColor=_LightGrey;
    
    UIView *moneyView=[UIView new];
    [topView addSubview:moneyView];
    [moneyView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.left.mas_equalTo(0);
        make.top.mas_equalTo(56);
        make.height.mas_equalTo(55);
    }];
    
    UIImageView *moneyImage=[UIImageView new];
    [moneyView addSubview:moneyImage];
    [moneyImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(10);
        make.width.mas_equalTo(15);
        make.height.mas_equalTo(20);
    }];
    moneyImage.image=[UIImage imageNamed:@"金额"];
    
    UILabel *moneyLabel=[UILabel new];
    [moneyView addSubview:moneyLabel];
    [moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(nameImage.mas_right).mas_equalTo(10);
        make.centerY.mas_equalTo(0);
    }];
    moneyLabel.font=[UIFont systemFontOfSize:17];
    moneyLabel.text=@"金额";
    moneyLabel.textColor=ColorWithRGB(49, 49, 49);
    
    _moneyLabel=[UILabel new];
    [moneyView addSubview:_moneyLabel];
    [_moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(imgaeView);
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(150);
    }];
    _moneyLabel.textAlignment=NSTextAlignmentRight;
    _moneyLabel.text=@"";
    _moneyLabel.font=[UIFont systemFontOfSize:15];
    _moneyLabel.textColor=[UIColor redColor];
    
    UIView *xianView2=[UIView new];
    [topView addSubview:xianView2];
    [xianView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.top.mas_equalTo(moneyView.mas_bottom);
        make.right.mas_equalTo(-5);
        make.height.mas_equalTo(1);
    }];
    xianView2.backgroundColor=_LightGrey;
    
    
    _textView=[UITextView new];
    [topView addSubview:_textView];
    [_textView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(xianView);
        make.bottom.mas_equalTo(-35);
        make.top.mas_equalTo(xianView2.mas_bottom).mas_equalTo(20);
        
    }];
    _textView.backgroundColor=[UIColor whiteColor];
    _textView.returnKeyType=UIReturnKeyDone;
    _textView.delegate=self;
    _textView.text=@"请详细输入你要写的文书需求，如案情经过、证据情况、以便律师更好地为您服务…";
    _textView.textColor=ColorWithRGB(149, 149, 149);
    _textView.font=[UIFont systemFontOfSize:15];
    
    _numLabel=[UILabel new];
    [topView addSubview:_numLabel];
    [_numLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(xianView2);
        make.bottom.mas_equalTo(-5);
    }];
    _numLabel.textColor=ColorWithRGB(149, 149, 149);
    _numLabel.font=[UIFont systemFontOfSize:14];
    _numLabel.text=@"0/200";
    
    UIView *bottoView=[UIView new];
    [_scrollView addSubview:bottoView];
    [bottoView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(topView);
        make.height.mas_equalTo(203);
        make.top.mas_equalTo(topView.mas_bottom).mas_equalTo(10);
    }];
    bottoView.backgroundColor=[UIColor whiteColor];
    bottoView.layer.cornerRadius=5;
    
    UIView *nameView=[UIView new];
    [bottoView addSubview:nameView];
    [nameView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.mas_equalTo(0);
        make.height.mas_equalTo(50);
    }];
    UILabel *nameLabel2=[UILabel new];
    [nameView addSubview:nameLabel2];
    [nameLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.centerY.mas_equalTo(0);
    }];
    nameLabel2.text=@"收件人:";
    nameLabel.textColor=ColorWithRGB(49, 49, 49);
    nameLabel2.font=[UIFont systemFontOfSize:16];
    
    _nameText=[UITextField new];
    [nameView addSubview:_nameText];
    [_nameText mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(150);
        make.height.mas_equalTo(30);
    }];
    _nameText.delegate=self;
    _nameText.placeholder=@"输入真实姓名";
    _nameText.textColor=ColorWithRGB(49, 49, 49);
    _nameText.font=[UIFont systemFontOfSize:16];
    _nameText.returnKeyType=UIReturnKeyDone;
    _nameText.textAlignment=NSTextAlignmentRight;
    
    UIView *xianView3=[UIView new];
    [bottoView addSubview:xianView3];
    [xianView3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(-10);
        make.height.mas_equalTo(1);
        make.top.mas_equalTo(nameView.mas_bottom).mas_equalTo(0);
    }];
    xianView3.backgroundColor=_LightGrey;
    
    
    UIView *phoneView=[UIView new];
    [bottoView addSubview:phoneView];
    [phoneView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.height.mas_equalTo(50);
        make.top.mas_equalTo(xianView3.mas_bottom);
    }];
    
    UILabel *phoneLabel=[UILabel new];
    [phoneView addSubview:phoneLabel];
    [phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.centerY.mas_equalTo(0);
    }];
    phoneLabel.text=@"电话:";
    phoneLabel.textColor=ColorWithRGB(49, 49, 49);
    phoneLabel.font=[UIFont systemFontOfSize:16];
    
    _phneText=[UITextField new];
    [phoneView addSubview:_phneText];
    [_phneText mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(150);
        make.height.mas_equalTo(30);
    }];
    _phneText.delegate=self;
    _phneText.placeholder=@"输入联系人真实电话号码";
    _phneText.textColor=ColorWithRGB(49, 49, 49);
    _phneText.font=[UIFont systemFontOfSize:16];
    _phneText.returnKeyType=UIReturnKeyDone;
    _phneText.textAlignment=NSTextAlignmentRight;
    
    UIView *xianView4=[UIView new];
    [bottoView addSubview:xianView4];
    [xianView4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(-10);
        make.height.mas_equalTo(1);
        make.top.mas_equalTo(phoneView.mas_bottom);
    }];
    xianView4.backgroundColor=_LightGrey;
    
    
    
    UIView *addView=[UIView new];
    [bottoView addSubview:addView];
    [addView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.height.mas_equalTo(50);
        make.top.mas_equalTo(xianView4.mas_bottom);
    }];
    addView.userInteractionEnabled=YES;
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(SelectAdd:)];
    [addView addGestureRecognizer:tapGesture];
    
    UILabel *addLabel=[UILabel new];
    [addView addSubview:addLabel];
    [addLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.centerY.mas_equalTo(0);
    }];
    addLabel.text=@"地区:";
    addLabel.textColor=ColorWithRGB(49, 49, 49);
    addLabel.font=[UIFont systemFontOfSize:16];
    
    _addLabel=[UILabel new];
    [addView addSubview:_addLabel];
    [_addLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(150);
        make.height.mas_equalTo(30);
    }];
    _addLabel.text=@"选择省/市/区";
    _addLabel.textColor=ColorWithRGB(222, 222, 222);
    _addLabel.font=[UIFont systemFontOfSize:16];
    _addLabel.textAlignment=NSTextAlignmentRight;
    
    UIView *xianView5=[UIView new];
    [bottoView addSubview:xianView5];
    [xianView5 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(-10);
        make.height.mas_equalTo(1);
        make.top.mas_equalTo(addView.mas_bottom);
    }];
    xianView5.backgroundColor=_LightGrey;
    
    
    UIView *xiangAddView=[UIView new];
    [bottoView addSubview:xiangAddView];
    [xiangAddView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.height.mas_equalTo(50);
        make.top.mas_equalTo(xianView5.mas_bottom);
    }];
    

    UILabel *addLabel2=[UILabel new];
    [xiangAddView addSubview:addLabel2];
    [addLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.centerY.mas_equalTo(0);
    }];
    addLabel2.text=@"详细地址:";
    addLabel2.textColor=ColorWithRGB(49, 49, 49);
    addLabel2.font=[UIFont systemFontOfSize:16];
    
   
    _addText=[UITextField new];
    [xiangAddView addSubview:_addText];
    [_addText mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(150);
        make.height.mas_equalTo(30);
    }];
    _addText.delegate=self;
    _addText.placeholder=@"输入路名或接到地址，门牌号";
    _addText.textColor=ColorWithRGB(49, 49, 49);
    _addText.font=[UIFont systemFontOfSize:16];
    _addText.returnKeyType=UIReturnKeyDone;
    _addText.textAlignment=NSTextAlignmentRight;
   
    
    
    _xieYiImage=[UIImageView new];
    [_scrollView addSubview:_xieYiImage];
    [_xieYiImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(20);
        make.width.height.mas_equalTo(25);
        make.top.mas_equalTo(bottoView.mas_bottom).mas_equalTo(20);
    }];
    if (_xieYi) {
        _xieYiImage.image=[UIImage imageNamed:@"是"];
    }else{
        _xieYiImage.image=[UIImage imageNamed:@"否"];
    }
    _xieYiImage.userInteractionEnabled=YES;
    UITapGestureRecognizer *tapGesture12 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(creatXieYe:)];
    [_xieYiImage addGestureRecognizer:tapGesture12];
    UILabel *xieYiLabel=[UILabel new];
    [_scrollView addSubview:xieYiLabel];
    [xieYiLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_xieYiImage.mas_right).mas_equalTo(20);
        make.centerY.mas_equalTo(_xieYiImage);
    }];
    NSMutableAttributedString *AttributedStr= [[NSMutableAttributedString alloc]initWithString:@"同意《独角兽平台声明》"];
    
    
    [AttributedStr addAttribute:NSForegroundColorAttributeName value:ColorWithRGB(149, 149, 149) range:NSMakeRange(0, 2)];
    [AttributedStr addAttribute:NSForegroundColorAttributeName value:ColorWithRGB(186, 151, 89) range:NSMakeRange(2, 9)];
    xieYiLabel.attributedText=AttributedStr;
    xieYiLabel.font=[UIFont systemFontOfSize:16];
    
    xieYiLabel.userInteractionEnabled=YES;
    UITapGestureRecognizer *tapGesture13 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pushToXieyi:)];
    [xieYiLabel addGestureRecognizer:tapGesture13];
    
    UIButton *btn=[UIButton new];
    [_scrollView addSubview:btn];
    [btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(20);
        make.width.mas_equalTo (_mainW-40);
        make.height.mas_equalTo(50);
        make.top.mas_equalTo(bottoView.mas_bottom).mas_equalTo(70);
    }];
    [btn setTitle:@"提交" forState:0];
    [btn setTitleColor:[UIColor whiteColor] forState:0];
    btn.layer.cornerRadius=10;
    btn.backgroundColor=_backgroundColor;
    [btn addTarget:self action:@selector(tiJiao:) forControlEvents:UIControlEventTouchUpInside];
    
    _scrollView.contentSize = CGSizeMake(0,1000);
}

-(void)SelectDocument:(UITapGestureRecognizer *)tap{
    SelectDocumentView *addView=[SelectDocumentView new];
    [self addSubview:addView];
    [addView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.bottom.mas_equalTo(0);
    }];
    addView.customSelectedBlock = ^ (NSDictionary *dic)
    {
        _documentDic=dic;
        NSNumber *dt_price=[dic objectForKey:@"dt_price"];
        if (dt_price.doubleValue==0) {
             _moneyLabel.text=[NSString stringWithFormat:@"¥价格待定"];
        }
        else{
             _moneyLabel.text=[NSString stringWithFormat:@"¥%@/份",dt_price];
        }
       
        _leiXinLabel.text=[dic objectForKey:@"dt_name"];
    };
    addView.type=@"1";
    [addView creatView];
}

-(void)LvSiFuWu{
    [_topView removeFromSuperview];
    [_LSView removeFromSuperview];
    [_addView removeFromSuperview];
    [_pingjiaView removeFromSuperview];
    
    _topView=[UIView new];
    [_scrollView addSubview:_topView];
    [_topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.width.mas_equalTo(_mainW-10);
        make.height.mas_equalTo(180);
        make.top.mas_equalTo(190);
    }];
    _topView.backgroundColor=[UIColor whiteColor];
    _topView.layer.cornerRadius=3;
    
    UIImageView *iamgeView=[UIImageView new];
    [_topView addSubview:iamgeView];
    [iamgeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(20);
        make.width.height.mas_equalTo(60);
    }];
    iamgeView.layer.cornerRadius=30;
    iamgeView.layer.masksToBounds=YES;
    NSString *news_cover=[_dic objectForKey:@"user_icon"];
    news_cover=[NSString stringWithFormat:@"%@%@",_addressUrl,news_cover];
    [iamgeView sd_setImageWithURL:[NSURL URLWithString:news_cover]];
    
    NSString *phoneStr=[_dic objectForKey:@"document_ship_name"];
    UILabel *label=[UILabel new];
    [_topView addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(iamgeView.mas_right).mas_equalTo(6);
        make.top.mas_equalTo(iamgeView);
        make.right.mas_equalTo(-120);
    }];
    label.text=phoneStr;
    label.textColor=ColorWithRGB(49, 49, 49);
    label.font=[UIFont systemFontOfSize:17];
    
    NSString *time=[_dic objectForKey:@"document_add_time_text"];
    UILabel *timeLabel=[UILabel new];
    [_topView addSubview:timeLabel];
    [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(label);
        make.bottom.mas_equalTo(iamgeView);
    }];
    timeLabel.text=time;
    timeLabel.font=[UIFont systemFontOfSize:14];
    timeLabel.textColor=ColorWithRGB(149, 149, 149);
    
    NSString *consult_ct_name=[_dic objectForKey:@"document_dt_name"];
    CGSize size=[ZQTools getNSStringWeight:consult_ct_name andViewWight:20 andFont:18];
    UILabel *ct_nameLabel=[UILabel new];
    [_topView addSubview:ct_nameLabel];
    [ct_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.height.mas_equalTo(30);
        make.centerY.mas_equalTo(label);
        make.width.mas_equalTo(size.width+14);
    }];
    ct_nameLabel.text=consult_ct_name;
    ct_nameLabel.font=[UIFont systemFontOfSize:16];
    ct_nameLabel.textColor=ColorWithRGB(76, 169, 221);
    [ct_nameLabel layoutIfNeeded];
    ct_nameLabel.textAlignment=NSTextAlignmentCenter;
    ct_nameLabel.layer.cornerRadius=4;
    ct_nameLabel.layer.borderWidth=1;
    ct_nameLabel.layer.borderColor=ColorWithRGB(76, 169, 221).CGColor;
    
    
    NSNumber *consult_money=[_dic objectForKey:@"document_money"];
    UILabel *moneyLabel=[UILabel new];
    [_topView addSubview:moneyLabel];
    [moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(timeLabel);
    }];
    moneyLabel.text=[NSString stringWithFormat:@"¥%@/份",consult_money];
    moneyLabel.textColor=[UIColor redColor];
    moneyLabel.font=[UIFont systemFontOfSize:14];
    
    NSString *document_content=[_dic objectForKey:@"document_content"];
   
    CGSize size2=[ZQTools getNSStringSize:document_content andViewWight:_mainW-30 andFont:16];
    
    UILabel *contentLabel=[UILabel new];
    [_topView addSubview:contentLabel];
    [contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(10);
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(timeLabel.mas_bottom).mas_equalTo(20);
    }];
    contentLabel.numberOfLines=3;
    contentLabel.text=document_content;
    contentLabel.textColor=ColorWithRGB(149, 149, 149);
    contentLabel.font=[UIFont systemFontOfSize:16];
    
    
    
    if (size2.height>65) {
        contentLabel.numberOfLines=2;
        UIImageView *imageView2=[UIImageView new];
        [_topView addSubview:imageView2];
        [imageView2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.mas_equalTo(0);
            make.bottom.mas_equalTo(-5);
            make.width.mas_equalTo(22);
            make.height.mas_equalTo(14);
        }];
        imageView2.image=[UIImage imageNamed:@"展开"];
//        imageView2.userInteractionEnabled=YES;
//        UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(LvSiFuWu2)];
//        [imageView2 addGestureRecognizer:tapGesture];
        
        UIView *anView=[UIView new];
        [_topView addSubview:anView];
        [anView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.mas_equalTo(0);
            make.top.mas_equalTo(contentLabel);
        }];
        anView.userInteractionEnabled=YES;
        UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(LvSiFuWu2)];
        [anView addGestureRecognizer:tapGesture];
    }
  
    
    _addView=[UIView new];
    [_scrollView addSubview:_addView];
    [_addView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(_topView);
        make.top.mas_equalTo(_topView.mas_bottom).mas_equalTo(20);
        make.height.mas_equalTo(190);
    }];
    _addView.backgroundColor=[UIColor whiteColor];
    _addView.layer.cornerRadius=4;
    
    UIImageView *imaView=[UIImageView new];
    [_scrollView addSubview:imaView];
    [imaView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(50);
        make.top.mas_equalTo(_topView.mas_bottom).mas_equalTo(-20);
        make.height.mas_equalTo(55);
        make.width.mas_equalTo(30);
    }];
    imaView.image=[UIImage imageNamed:@"纽带"];
    
    UIImageView *imaView12=[UIImageView new];
    [_scrollView addSubview:imaView12];
    [imaView12 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_mainW-80);
        make.top.mas_equalTo(_topView.mas_bottom).mas_equalTo(-20);
        make.height.mas_equalTo(55);
        make.width.mas_equalTo(30);
    }];
    imaView12.image=[UIImage imageNamed:@"纽带"];
    
    UIView *nameView=[UIView new];
    [_addView addSubview:nameView];
    [nameView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.mas_equalTo(0);
        make.height.mas_equalTo(50);
    }];
    
    UILabel *nameLabel=[UILabel new];
    [nameView addSubview: nameLabel];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(10);
    }];
    nameLabel.text=@"收件人";
    nameLabel.font=[UIFont systemFontOfSize:16];
    nameLabel.textColor=ColorWithRGB(49, 49, 49);
    
    UILabel *nameLabe2=[UILabel new];
    [nameView addSubview:nameLabe2];
    [nameLabe2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(-10);
        make.left.mas_equalTo(150);
    }];
    nameLabe2.text=[_dic objectForKey:@"document_ship_name"];
    nameLabe2.textColor=ColorWithRGB(70, 70, 70);
    nameLabe2.font=[UIFont systemFontOfSize:16];
    nameLabe2.textAlignment=NSTextAlignmentRight;
    
    UIView *xianView3=[UIView new];
    [_addView addSubview:xianView3];
    [xianView3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(0);
        make.height.mas_equalTo(1);
        make.top.mas_equalTo(nameView.mas_bottom);
    }];
    xianView3.backgroundColor=_LightGrey;
    
    
    UIView *phoneView=[UIView new];
    [_addView addSubview:phoneView];
    [phoneView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(xianView3.mas_bottom);
        make.height.mas_equalTo(50);
    }];
    
    UILabel *phoneLabel=[UILabel new];
    [phoneView addSubview: phoneLabel];
    [phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(10);
    }];
    phoneLabel.text=@"电话";
    phoneLabel.font=[UIFont systemFontOfSize:16];
    phoneLabel.textColor=ColorWithRGB(49, 49, 49);
    
    UILabel *phoneLabe2=[UILabel new];
    [phoneView addSubview:phoneLabe2];
    [phoneLabe2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(-10);
    }];
    phoneLabe2.text=[_dic objectForKey:@"document_ship_hpone"];
    phoneLabe2.textColor=ColorWithRGB(70, 70, 70);
    phoneLabe2.font=[UIFont systemFontOfSize:16];
    phoneLabe2.textAlignment=NSTextAlignmentRight;
    
    UIView *xianView2=[UIView new];
    [_addView addSubview:xianView2];
    [xianView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(0);
        make.height.mas_equalTo(1);
        make.top.mas_equalTo(phoneView.mas_bottom);
    }];
    xianView2.backgroundColor=_LightGrey;
    
    
    UIView *addView=[UIView new];
    [_addView addSubview:addView];
    [addView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(xianView2.mas_bottom);
        make.height.mas_equalTo(50);
    }];
    
    UILabel *addLabe=[UILabel new];
    [addView addSubview: addLabe];
    [addLabe mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(10);
    }];
    addLabe.text=@"收件地址";
    addLabe.font=[UIFont systemFontOfSize:16];
    addLabe.textColor=ColorWithRGB(49, 49, 49);
    
    UILabel *addLabe2=[UILabel new];
    [addView addSubview:addLabe2];
    [addLabe2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(addLabe);
        make.left.mas_equalTo(130);
    }];
    addLabe2.numberOfLines=0;
    addLabe2.text=[_dic objectForKey:@"document_ship_address"];
    addLabe2.textColor=ColorWithRGB(70, 70, 70);
    addLabe2.font=[UIFont systemFontOfSize:16];
    addLabe2.textAlignment=NSTextAlignmentRight;
    
    
    _LSView=[UIView new];
    [_scrollView addSubview:_LSView];
    [_LSView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(_topView);
        make.height.mas_equalTo(180);
        make.top.mas_equalTo(_addView.mas_bottom).mas_equalTo(25);
    }];
    _LSView.backgroundColor=[UIColor whiteColor];
    _LSView.layer.cornerRadius=3;
    
    
    
    UIView *xianView=[UIView new];
    [_LSView addSubview:xianView];
    [xianView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(3);
        make.height.mas_equalTo(20);
    }];
    xianView.backgroundColor=_backgroundColor;
    
    UILabel *woDeLabel=[UILabel new];
    [_LSView addSubview:woDeLabel];
    [woDeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(xianView);
        make.left.mas_equalTo(xianView.mas_right).mas_equalTo(10);
    }];
    woDeLabel.text=@"我的律师";
    woDeLabel.textColor=ColorWithRGB(49, 49, 49);
    woDeLabel.font=[UIFont systemFontOfSize:22];
    
    UIImageView *lsImage=[UIImageView new];
    [_LSView addSubview:lsImage];
    [lsImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(50);
        make.centerY.mas_equalTo(0);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(60);
    }];
    lsImage.image=[UIImage imageNamed:@"律师服务"];
    
    UILabel *dengDai=[UILabel new];
    [_LSView addSubview:dengDai];
    [dengDai mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(lsImage.mas_right).mas_equalTo(20);
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(-20);
    }];
    dengDai.text=@"律师正在服务，请耐心等待...";
    dengDai.textColor=ColorWithRGB(219, 175, 0);
    dengDai.font=[UIFont systemFontOfSize:22];
    
    _scrollView.contentSize = CGSizeMake(0,800);
    
}

-(void)LvSiFuWu2{
    [_topView removeFromSuperview];
    [_LSView removeFromSuperview];
    [_addView removeFromSuperview];
    [_pingjiaView removeFromSuperview];
    
    NSString *document_content=[_dic objectForKey:@"document_content"];
    CGSize size2=[ZQTools getNSStringSize:document_content andViewWight:_mainW-30 andFont:16];
    
    _topView=[UIView new];
    [_scrollView addSubview:_topView];
    [_topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.width.mas_equalTo(_mainW-10);
        make.height.mas_equalTo(140+size2.height);
        make.top.mas_equalTo(190);
    }];
    _topView.backgroundColor=[UIColor whiteColor];
    _topView.layer.cornerRadius=3;
    
    UIImageView *iamgeView=[UIImageView new];
    [_topView addSubview:iamgeView];
    [iamgeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(20);
        make.width.height.mas_equalTo(60);
    }];
    iamgeView.layer.cornerRadius=30;
    iamgeView.layer.masksToBounds=YES;
    NSString *news_cover=[_dic objectForKey:@"user_icon"];
    news_cover=[NSString stringWithFormat:@"%@%@",_addressUrl,news_cover];
    [iamgeView sd_setImageWithURL:[NSURL URLWithString:news_cover]];
    
    NSString *phoneStr=[_dic objectForKey:@"document_ship_name"];
    UILabel *label=[UILabel new];
    [_topView addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(iamgeView.mas_right).mas_equalTo(6);
        make.top.mas_equalTo(iamgeView);
        make.right.mas_equalTo(-120);
    }];
    label.text=phoneStr;
    label.textColor=ColorWithRGB(49, 49, 49);
    label.font=[UIFont systemFontOfSize:17];
    
    NSString *time=[_dic objectForKey:@"document_add_time_text"];
    UILabel *timeLabel=[UILabel new];
    [_topView addSubview:timeLabel];
    [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(label);
        make.bottom.mas_equalTo(iamgeView);
    }];
    timeLabel.text=time;
    timeLabel.font=[UIFont systemFontOfSize:14];
    timeLabel.textColor=ColorWithRGB(149, 149, 149);
    
    NSString *consult_ct_name=[_dic objectForKey:@"document_dt_name"];
    CGSize size=[ZQTools getNSStringWeight:consult_ct_name andViewWight:20 andFont:18];
    UILabel *ct_nameLabel=[UILabel new];
    [_topView addSubview:ct_nameLabel];
    [ct_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.height.mas_equalTo(30);
        make.centerY.mas_equalTo(label);
        make.width.mas_equalTo(size.width+14);
    }];
    ct_nameLabel.text=consult_ct_name;
    ct_nameLabel.font=[UIFont systemFontOfSize:16];
    ct_nameLabel.textColor=ColorWithRGB(76, 169, 221);
    [ct_nameLabel layoutIfNeeded];
    ct_nameLabel.textAlignment=NSTextAlignmentCenter;
    ct_nameLabel.layer.cornerRadius=4;
    ct_nameLabel.layer.borderWidth=1;
    ct_nameLabel.layer.borderColor=ColorWithRGB(76, 169, 221).CGColor;
    
    
    NSNumber *consult_money=[_dic objectForKey:@"document_money"];
    UILabel *moneyLabel=[UILabel new];
    [_topView addSubview:moneyLabel];
    [moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(timeLabel);
    }];
    moneyLabel.text=[NSString stringWithFormat:@"¥%@/份",consult_money];
    moneyLabel.textColor=[UIColor redColor];
    moneyLabel.font=[UIFont systemFontOfSize:14];
    
    
    UILabel *contentLabel=[UILabel new];
    [_topView addSubview:contentLabel];
    [contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(10);
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(timeLabel.mas_bottom).mas_equalTo(20);
    }];
    contentLabel.numberOfLines=0;
    contentLabel.text=document_content;
    contentLabel.textColor=ColorWithRGB(149, 149, 149);
    contentLabel.font=[UIFont systemFontOfSize:16];
    
    
    
    UIImageView *imageView2=[UIImageView new];
    [_topView addSubview:imageView2];
    [imageView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(0);
        make.bottom.mas_equalTo(-5);
        make.width.mas_equalTo(22);
        make.height.mas_equalTo(14);
    }];
    imageView2.image=[UIImage imageNamed:@"收起"];
    
    UIView *anView=[UIView new];
    [_topView addSubview:anView];
    [anView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.mas_equalTo(0);
        make.top.mas_equalTo(contentLabel);
    }];
    anView.userInteractionEnabled=YES;
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(LvSiFuWu)];
    [anView addGestureRecognizer:tapGesture];
    
   
    
    
    _addView=[UIView new];
    [_scrollView addSubview:_addView];
    [_addView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(_topView);
        make.top.mas_equalTo(_topView.mas_bottom).mas_equalTo(20);
        make.height.mas_equalTo(190);
    }];
    _addView.backgroundColor=[UIColor whiteColor];
    _addView.layer.cornerRadius=4;
    
    UIImageView *imaView=[UIImageView new];
    [_scrollView addSubview:imaView];
    [imaView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(50);
        make.top.mas_equalTo(_topView.mas_bottom).mas_equalTo(-20);
        make.height.mas_equalTo(55);
        make.width.mas_equalTo(30);
    }];
    imaView.image=[UIImage imageNamed:@"纽带"];
    
    UIImageView *imaView12=[UIImageView new];
    [_scrollView addSubview:imaView12];
    [imaView12 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_mainW-80);
        make.top.mas_equalTo(_topView.mas_bottom).mas_equalTo(-20);
        make.height.mas_equalTo(55);
        make.width.mas_equalTo(30);
    }];
    imaView12.image=[UIImage imageNamed:@"纽带"];
    
    UIView *nameView=[UIView new];
    [_addView addSubview:nameView];
    [nameView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.mas_equalTo(0);
        make.height.mas_equalTo(50);
    }];
    
    UILabel *nameLabel=[UILabel new];
    [nameView addSubview: nameLabel];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(10);
    }];
    nameLabel.text=@"收件人";
    nameLabel.font=[UIFont systemFontOfSize:16];
    nameLabel.textColor=ColorWithRGB(49, 49, 49);
    
    UILabel *nameLabe2=[UILabel new];
    [nameView addSubview:nameLabe2];
    [nameLabe2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(-10);
        make.left.mas_equalTo(150);
    }];
    nameLabe2.text=[_dic objectForKey:@"document_ship_name"];
    nameLabe2.textColor=ColorWithRGB(70, 70, 70);
    nameLabe2.font=[UIFont systemFontOfSize:16];
    nameLabe2.textAlignment=NSTextAlignmentRight;
    
    UIView *xianView3=[UIView new];
    [_addView addSubview:xianView3];
    [xianView3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(0);
        make.height.mas_equalTo(1);
        make.top.mas_equalTo(nameView.mas_bottom);
    }];
    xianView3.backgroundColor=_LightGrey;
    
    
    UIView *phoneView=[UIView new];
    [_addView addSubview:phoneView];
    [phoneView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(xianView3.mas_bottom);
        make.height.mas_equalTo(50);
    }];
    
    UILabel *phoneLabel=[UILabel new];
    [phoneView addSubview: phoneLabel];
    [phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(10);
    }];
    phoneLabel.text=@"电话";
    phoneLabel.font=[UIFont systemFontOfSize:16];
    phoneLabel.textColor=ColorWithRGB(49, 49, 49);
    
    UILabel *phoneLabe2=[UILabel new];
    [phoneView addSubview:phoneLabe2];
    [phoneLabe2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(-10);
    }];
    phoneLabe2.text=[_dic objectForKey:@"document_ship_hpone"];
    phoneLabe2.textColor=ColorWithRGB(70, 70, 70);
    phoneLabe2.font=[UIFont systemFontOfSize:16];
    phoneLabe2.textAlignment=NSTextAlignmentRight;
    
    UIView *xianView2=[UIView new];
    [_addView addSubview:xianView2];
    [xianView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(0);
        make.height.mas_equalTo(1);
        make.top.mas_equalTo(phoneView.mas_bottom);
    }];
    xianView2.backgroundColor=_LightGrey;
    
    
    UIView *addView=[UIView new];
    [_addView addSubview:addView];
    [addView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(xianView2.mas_bottom);
        make.height.mas_equalTo(50);
    }];
    
    UILabel *addLabe=[UILabel new];
    [addView addSubview: addLabe];
    [addLabe mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(10);
    }];
    addLabe.text=@"收件地址";
    addLabe.font=[UIFont systemFontOfSize:16];
    addLabe.textColor=ColorWithRGB(49, 49, 49);
    
    UILabel *addLabe2=[UILabel new];
    [addView addSubview:addLabe2];
    [addLabe2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(addLabe);
        make.left.mas_equalTo(130);
    }];
    addLabe2.numberOfLines=0;
    addLabe2.text=[_dic objectForKey:@"document_ship_address"];
    addLabe2.textColor=ColorWithRGB(70, 70, 70);
    addLabe2.font=[UIFont systemFontOfSize:16];
    addLabe2.textAlignment=NSTextAlignmentRight;
    
    
    _LSView=[UIView new];
    [_scrollView addSubview:_LSView];
    [_LSView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(_topView);
        make.height.mas_equalTo(180);
        make.top.mas_equalTo(_addView.mas_bottom).mas_equalTo(20);
    }];
    _LSView.backgroundColor=[UIColor whiteColor];
    _LSView.layer.cornerRadius=3;
    
    UIView *xianView=[UIView new];
    [_LSView addSubview:xianView];
    [xianView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(3);
        make.height.mas_equalTo(20);
    }];
    xianView.backgroundColor=_backgroundColor;
    
    UILabel *woDeLabel=[UILabel new];
    [_LSView addSubview:woDeLabel];
    [woDeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(xianView);
        make.left.mas_equalTo(xianView.mas_right).mas_equalTo(10);
    }];
    woDeLabel.text=@"我的律师";
    woDeLabel.textColor=ColorWithRGB(49, 49, 49);
    woDeLabel.font=[UIFont systemFontOfSize:22];
    
    UIImageView *lsImage=[UIImageView new];
    [_LSView addSubview:lsImage];
    [lsImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(50);
        make.centerY.mas_equalTo(0);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(60);
    }];
    lsImage.image=[UIImage imageNamed:@"律师服务"];
    
    UILabel *dengDai=[UILabel new];
    [_LSView addSubview:dengDai];
    [dengDai mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(lsImage.mas_right).mas_equalTo(20);
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(-20);
    }];
    dengDai.text=@"律师正在服务，请耐心等待...";
    dengDai.textColor=ColorWithRGB(219, 175, 0);
    dengDai.font=[UIFont systemFontOfSize:22];
    
    _scrollView.contentSize = CGSizeMake(0,800+size2.height);
    
}

-(void)pingJiaView{
    [_topView removeFromSuperview];
    [_LSView removeFromSuperview];
    [_addView removeFromSuperview];
    [_pingjiaView removeFromSuperview];
    
    _topView=[UIView new];
    [_scrollView addSubview:_topView];
    [_topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.width.mas_equalTo(_mainW-10);
        make.height.mas_equalTo(180);
        make.top.mas_equalTo(190);
    }];
    _topView.backgroundColor=[UIColor whiteColor];
    _topView.layer.cornerRadius=3;
    
    UIImageView *iamgeView=[UIImageView new];
    [_topView addSubview:iamgeView];
    [iamgeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(20);
        make.width.height.mas_equalTo(60);
    }];
    iamgeView.layer.cornerRadius=30;
    iamgeView.layer.masksToBounds=YES;
    NSString *news_cover=[_dic objectForKey:@"user_icon"];
    news_cover=[NSString stringWithFormat:@"%@%@",_addressUrl,news_cover];
    [iamgeView sd_setImageWithURL:[NSURL URLWithString:news_cover]];
    
    NSString *phoneStr=[_dic objectForKey:@"document_ship_name"];
    UILabel *label=[UILabel new];
    [_topView addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(iamgeView.mas_right).mas_equalTo(6);
        make.top.mas_equalTo(iamgeView);
        make.right.mas_equalTo(-120);
    }];
    label.text=phoneStr;
    label.textColor=ColorWithRGB(49, 49, 49);
    label.font=[UIFont systemFontOfSize:17];
    
    NSString *time=[_dic objectForKey:@"document_add_time_text"];
    UILabel *timeLabel=[UILabel new];
    [_topView addSubview:timeLabel];
    [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(label);
        make.bottom.mas_equalTo(iamgeView);
    }];
    timeLabel.text=time;
    timeLabel.font=[UIFont systemFontOfSize:14];
    timeLabel.textColor=ColorWithRGB(149, 149, 149);
    
    NSString *consult_ct_name=[_dic objectForKey:@"document_dt_name"];
    CGSize size=[ZQTools getNSStringWeight:consult_ct_name andViewWight:20 andFont:18];
    UILabel *ct_nameLabel=[UILabel new];
    [_topView addSubview:ct_nameLabel];
    [ct_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.height.mas_equalTo(30);
        make.centerY.mas_equalTo(label);
        make.width.mas_equalTo(size.width+14);
    }];
    ct_nameLabel.text=consult_ct_name;
    ct_nameLabel.font=[UIFont systemFontOfSize:16];
    ct_nameLabel.textColor=ColorWithRGB(76, 169, 221);
    [ct_nameLabel layoutIfNeeded];
    ct_nameLabel.textAlignment=NSTextAlignmentCenter;
    ct_nameLabel.layer.cornerRadius=4;
    ct_nameLabel.layer.borderWidth=1;
    ct_nameLabel.layer.borderColor=ColorWithRGB(76, 169, 221).CGColor;
    
    
    NSNumber *consult_money=[_dic objectForKey:@"document_money"];
    UILabel *moneyLabel=[UILabel new];
    [_topView addSubview:moneyLabel];
    [moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(timeLabel);
    }];
    moneyLabel.text=[NSString stringWithFormat:@"¥%@/份",consult_money];
    moneyLabel.textColor=[UIColor redColor];
    moneyLabel.font=[UIFont systemFontOfSize:14];
    
    NSString *document_content=[_dic objectForKey:@"document_content"];
    
    CGSize size2=[ZQTools getNSStringSize:document_content andViewWight:_mainW-30 andFont:16];
    
    UILabel *contentLabel=[UILabel new];
    [_topView addSubview:contentLabel];
    [contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(10);
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(timeLabel.mas_bottom).mas_equalTo(20);
    }];
    contentLabel.numberOfLines=3;
    contentLabel.text=document_content;
    contentLabel.textColor=ColorWithRGB(149, 149, 149);
    contentLabel.font=[UIFont systemFontOfSize:16];
    
  
    
    if (size2.height>65) {
        contentLabel.numberOfLines=2;
        UIImageView *imageView2=[UIImageView new];
        [_topView addSubview:imageView2];
        [imageView2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.mas_equalTo(0);
            make.bottom.mas_equalTo(-5);
            make.width.mas_equalTo(22);
            make.height.mas_equalTo(14);
        }];
        imageView2.image=[UIImage imageNamed:@"展开"];
//        imageView2.userInteractionEnabled=YES;
//        UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pingJiaView2)];
//        [imageView2 addGestureRecognizer:tapGesture];
        
        UIView *anView=[UIView new];
        [_topView addSubview:anView];
        [anView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.mas_equalTo(0);
            make.top.mas_equalTo(contentLabel);
        }];
        anView.userInteractionEnabled=YES;
        UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pingJiaView2)];
        [anView addGestureRecognizer:tapGesture];

    }
    
    
    
    _addView=[UIView new];
    [_scrollView addSubview:_addView];
    [_addView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(_topView);
        make.top.mas_equalTo(_topView.mas_bottom).mas_equalTo(20);
        make.height.mas_equalTo(190);
    }];
    _addView.backgroundColor=[UIColor whiteColor];
    _addView.layer.cornerRadius=4;
    
    UIImageView *imaView=[UIImageView new];
    [_scrollView addSubview:imaView];
    [imaView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(50);
        make.top.mas_equalTo(_topView.mas_bottom).mas_equalTo(-20);
        make.height.mas_equalTo(55);
        make.width.mas_equalTo(30);
    }];
    imaView.image=[UIImage imageNamed:@"纽带"];
    
    UIImageView *imaView12=[UIImageView new];
    [_scrollView addSubview:imaView12];
    [imaView12 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_mainW-80);
        make.top.mas_equalTo(_topView.mas_bottom).mas_equalTo(-20);
        make.height.mas_equalTo(55);
        make.width.mas_equalTo(30);
    }];
    imaView12.image=[UIImage imageNamed:@"纽带"];
    
    UIView *nameView=[UIView new];
    [_addView addSubview:nameView];
    [nameView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.mas_equalTo(0);
        make.height.mas_equalTo(50);
    }];
    
    UILabel *nameLabel=[UILabel new];
    [nameView addSubview: nameLabel];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(10);
    }];
    nameLabel.text=@"收件人";
    nameLabel.font=[UIFont systemFontOfSize:16];
    nameLabel.textColor=ColorWithRGB(49, 49, 49);
    
    UILabel *nameLabe2=[UILabel new];
    [nameView addSubview:nameLabe2];
    [nameLabe2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(-10);
        make.left.mas_equalTo(150);
    }];
    nameLabe2.text=[_dic objectForKey:@"document_ship_name"];
    nameLabe2.textColor=ColorWithRGB(70, 70, 70);
    nameLabe2.font=[UIFont systemFontOfSize:16];
    nameLabe2.textAlignment=NSTextAlignmentRight;
    
    UIView *xianView3=[UIView new];
    [_addView addSubview:xianView3];
    [xianView3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(0);
        make.height.mas_equalTo(1);
        make.top.mas_equalTo(nameView.mas_bottom);
    }];
    xianView3.backgroundColor=_LightGrey;
    
    
    UIView *phoneView=[UIView new];
    [_addView addSubview:phoneView];
    [phoneView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(xianView3.mas_bottom);
        make.height.mas_equalTo(50);
    }];
    
    UILabel *phoneLabel=[UILabel new];
    [phoneView addSubview: phoneLabel];
    [phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(10);
    }];
    phoneLabel.text=@"电话";
    phoneLabel.font=[UIFont systemFontOfSize:16];
    phoneLabel.textColor=ColorWithRGB(49, 49, 49);
    
    UILabel *phoneLabe2=[UILabel new];
    [phoneView addSubview:phoneLabe2];
    [phoneLabe2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(-10);
    }];
    phoneLabe2.text=[_dic objectForKey:@"document_ship_hpone"];
    phoneLabe2.textColor=ColorWithRGB(70, 70, 70);
    phoneLabe2.font=[UIFont systemFontOfSize:16];
    phoneLabe2.textAlignment=NSTextAlignmentRight;
    
    UIView *xianView2=[UIView new];
    [_addView addSubview:xianView2];
    [xianView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(0);
        make.height.mas_equalTo(1);
        make.top.mas_equalTo(phoneView.mas_bottom);
    }];
    xianView2.backgroundColor=_LightGrey;
    
    
    UIView *addView=[UIView new];
    [_addView addSubview:addView];
    [addView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(xianView2.mas_bottom);
        make.height.mas_equalTo(50);
    }];
    
    UILabel *addLabe=[UILabel new];
    [addView addSubview: addLabe];
    [addLabe mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(10);
    }];
    addLabe.text=@"收件地址";
    addLabe.font=[UIFont systemFontOfSize:16];
    addLabe.textColor=ColorWithRGB(49, 49, 49);
    
    UILabel *addLabe2=[UILabel new];
    [addView addSubview:addLabe2];
    [addLabe2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(addLabe);
        make.left.mas_equalTo(130);
    }];
    addLabe2.numberOfLines=0;
    addLabe2.text=[_dic objectForKey:@"document_ship_address"];
    addLabe2.textColor=ColorWithRGB(70, 70, 70);
    addLabe2.font=[UIFont systemFontOfSize:16];
    addLabe2.textAlignment=NSTextAlignmentRight;
    
    
    _LSView=[UIView new];
    [_scrollView addSubview:_LSView];
    [_LSView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(_topView);
        make.height.mas_equalTo(180);
        make.top.mas_equalTo(_addView.mas_bottom).mas_equalTo(25);
    }];
    _LSView.backgroundColor=[UIColor whiteColor];
    _LSView.layer.cornerRadius=3;
    
    
    
    UIView *xianView=[UIView new];
    [_LSView addSubview:xianView];
    [xianView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(3);
        make.height.mas_equalTo(20);
    }];
    xianView.backgroundColor=_backgroundColor;
    
    UILabel *woDeLabel=[UILabel new];
    [_LSView addSubview:woDeLabel];
    [woDeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(xianView);
        make.left.mas_equalTo(xianView.mas_right).mas_equalTo(10);
    }];
    woDeLabel.text=@"我的律师";
    woDeLabel.textColor=ColorWithRGB(49, 49, 49);
    woDeLabel.font=[UIFont systemFontOfSize:22];
    
    NSDictionary *lawyer_info=[_dic objectForKey:@"lawyer_info"];
    
    UIImageView *userImage=[UIImageView new];
    [_LSView addSubview:userImage];
    [userImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(woDeLabel.mas_bottom).mas_equalTo(25);
        make.width.height.mas_equalTo(70);
    }];
    userImage.layer.masksToBounds=YES;
    userImage.layer.cornerRadius=35;
    NSString *waiter_icon=[lawyer_info objectForKey:@"waiter_icon"];
    waiter_icon=[NSString stringWithFormat:@"%@%@",_addressUrl,waiter_icon];
    [userImage sd_setImageWithURL:[NSURL URLWithString:waiter_icon]];
    
    UILabel *nameLabel12=[UILabel new];
    [_LSView addSubview:nameLabel12];
    [nameLabel12 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(userImage.mas_top);
        make.left.mas_equalTo(userImage.mas_right).mas_equalTo(15);
    }];
    nameLabel12.textColor=ColorWithRGB(49, 49, 49);
    nameLabel12.text=[lawyer_info objectForKey:@"waiter_name"];
    nameLabel12.font=[UIFont systemFontOfSize:17];
    float width=0;
    
    NSString *wl_field_names=[lawyer_info objectForKey:@"wl_field_names"];
    if ([ZQTools charIsNil:wl_field_names]) {
         _scrollView.contentSize = CGSizeMake(0,830);
        return;
    }
    NSArray *biaoQian=[wl_field_names componentsSeparatedByString:@","];
    int abc=biaoQian.count;
    if (biaoQian.count>2) {
        abc=2;
    }
    for (int i=0; i<abc; i++) {
        NSString *biaoStr=biaoQian[i];
        CGSize size=[ZQTools getNSStringWeight:biaoStr andViewWight:16 andFont:16 ];
        
        UILabel *label=[UILabel new];
        [_LSView addSubview:label];
        [label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(userImage.mas_right).mas_equalTo(15+width);
            make.height.mas_equalTo(20);
            make.width.mas_equalTo(size.width+16);
            make.bottom.mas_equalTo(userImage);
        }];
        label.text=biaoQian[i];
        label.font=[UIFont systemFontOfSize:16];
        label.textColor=ColorWithRGB(149, 149, 149);
        label.layer.cornerRadius=4;
        label.layer.borderColor=ColorWithRGB(149,149, 149).CGColor;
        label.layer.borderWidth=1;
        label.textAlignment=NSTextAlignmentCenter;
        width=width+size.width+30;
    }
    
    UIView *xianZaiView=[UIView new];
    [_LSView addSubview:xianZaiView];
    [xianZaiView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.width.mas_equalTo(100);
        make.centerY.mas_equalTo(0);
        make.height.mas_equalTo(100);
    }];
    xianZaiView.layer.borderColor=_LightGrey.CGColor;
    xianZaiView.layer.borderWidth=1;
    
    xianZaiView.userInteractionEnabled=YES;
    UITapGestureRecognizer *tapGesture12 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(xiazai)];
    [xianZaiView addGestureRecognizer:tapGesture12];
    
    UIImageView *xiaZai=[UIImageView new];
    [xianZaiView addSubview:xiaZai];
    [xiaZai mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(0);
        make.top.mas_equalTo(15);
        make.width.height.mas_equalTo(30);
    }];
    xiaZai.image=[UIImage imageNamed:@"下载文件"];
    
    UIView *xianView13=[UIView new];
    [xianZaiView addSubview:xianView13];
    [xianView13 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.bottom.mas_equalTo(-30);
        make.height.mas_equalTo(1);
    }];
    xianView13.backgroundColor=_LightGrey;
    
    UILabel *lable23=[UILabel new];
    [xianZaiView addSubview:lable23];
    [lable23 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(0);
        make.top.mas_equalTo(xianView13.mas_bottom).mas_equalTo(5);
    }];

    lable23.text=[NSString stringWithFormat:@"下载%@",[_dic objectForKey:@"document_dt_name"]];
    lable23.textColor=ColorWithRGB(149, 149, 149);
    lable23.font=[UIFont systemFontOfSize:13];
    
    
    
   
    
}

-(void)pingJiaView2{
    [_topView removeFromSuperview];
    [_LSView removeFromSuperview];
    [_addView removeFromSuperview];
    [_pingjiaView removeFromSuperview];
    
   NSString *document_content=[_dic objectForKey:@"document_content"];
    CGSize size2=[ZQTools getNSStringSize:document_content andViewWight:_mainW-30 andFont:16];
    
    _topView=[UIView new];
    [_scrollView addSubview:_topView];
    [_topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.width.mas_equalTo(_mainW-10);
        make.height.mas_equalTo(140+size2.height);
        make.top.mas_equalTo(190);
    }];
    _topView.backgroundColor=[UIColor whiteColor];
    _topView.layer.cornerRadius=3;
    
    UIImageView *iamgeView=[UIImageView new];
    [_topView addSubview:iamgeView];
    [iamgeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(20);
        make.width.height.mas_equalTo(60);
    }];
    iamgeView.layer.cornerRadius=30;
    iamgeView.layer.masksToBounds=YES;
    NSString *news_cover=[_dic objectForKey:@"user_icon"];
    news_cover=[NSString stringWithFormat:@"%@%@",_addressUrl,news_cover];
    [iamgeView sd_setImageWithURL:[NSURL URLWithString:news_cover]];
    
    NSString *phoneStr=[_dic objectForKey:@"document_ship_name"];
    UILabel *label=[UILabel new];
    [_topView addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(iamgeView.mas_right).mas_equalTo(6);
        make.top.mas_equalTo(iamgeView);
        make.right.mas_equalTo(-120);
    }];
    label.text=phoneStr;
    label.textColor=ColorWithRGB(49, 49, 49);
    label.font=[UIFont systemFontOfSize:17];
    
    NSString *time=[_dic objectForKey:@"document_add_time_text"];
    UILabel *timeLabel=[UILabel new];
    [_topView addSubview:timeLabel];
    [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(label);
        make.bottom.mas_equalTo(iamgeView);
    }];
    timeLabel.text=time;
    timeLabel.font=[UIFont systemFontOfSize:14];
    timeLabel.textColor=ColorWithRGB(149, 149, 149);
    
    NSString *consult_ct_name=[_dic objectForKey:@"document_dt_name"];
    CGSize size=[ZQTools getNSStringWeight:consult_ct_name andViewWight:20 andFont:18];
    UILabel *ct_nameLabel=[UILabel new];
    [_topView addSubview:ct_nameLabel];
    [ct_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.height.mas_equalTo(30);
        make.centerY.mas_equalTo(label);
        make.width.mas_equalTo(size.width+14);
    }];
    ct_nameLabel.text=consult_ct_name;
    ct_nameLabel.font=[UIFont systemFontOfSize:16];
    ct_nameLabel.textColor=ColorWithRGB(76, 169, 221);
    [ct_nameLabel layoutIfNeeded];
    ct_nameLabel.textAlignment=NSTextAlignmentCenter;
    ct_nameLabel.layer.cornerRadius=4;
    ct_nameLabel.layer.borderWidth=1;
    ct_nameLabel.layer.borderColor=ColorWithRGB(76, 169, 221).CGColor;
    
    
    NSNumber *consult_money=[_dic objectForKey:@"document_money"];
    UILabel *moneyLabel=[UILabel new];
    [_topView addSubview:moneyLabel];
    [moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(timeLabel);
    }];
    moneyLabel.text=[NSString stringWithFormat:@"¥%@/份",consult_money];
    moneyLabel.textColor=[UIColor redColor];
    moneyLabel.font=[UIFont systemFontOfSize:14];
    
    //    NSString *document_content=[_dic objectForKey:@"document_content"];
    
    
    UILabel *contentLabel=[UILabel new];
    [_topView addSubview:contentLabel];
    [contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(10);
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(timeLabel.mas_bottom).mas_equalTo(20);
    }];
    contentLabel.numberOfLines=0;
    contentLabel.text=document_content;
    contentLabel.textColor=ColorWithRGB(149, 149, 149);
    contentLabel.font=[UIFont systemFontOfSize:16];
    
    
    
    UIImageView *imageView2=[UIImageView new];
    [_topView addSubview:imageView2];
    [imageView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(0);
        make.bottom.mas_equalTo(-5);
        make.width.mas_equalTo(22);
        make.height.mas_equalTo(14);
    }];
    imageView2.image=[UIImage imageNamed:@"收起"];
//    imageView2.userInteractionEnabled=YES;
//    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pingJiaView)];
//    [imageView2 addGestureRecognizer:tapGesture];
    
    UIView *anView=[UIView new];
    [_topView addSubview:anView];
    [anView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.mas_equalTo(0);
        make.top.mas_equalTo(contentLabel);
    }];
    anView.userInteractionEnabled=YES;
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pingJiaView)];
    [anView addGestureRecognizer:tapGesture];
    
    
    _addView=[UIView new];
    [_scrollView addSubview:_addView];
    [_addView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(_topView);
        make.top.mas_equalTo(_topView.mas_bottom).mas_equalTo(20);
        make.height.mas_equalTo(190);
    }];
    _addView.backgroundColor=[UIColor whiteColor];
    _addView.layer.cornerRadius=4;
    
    UIImageView *imaView=[UIImageView new];
    [_scrollView addSubview:imaView];
    [imaView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(50);
        make.top.mas_equalTo(_topView.mas_bottom).mas_equalTo(-20);
        make.height.mas_equalTo(55);
        make.width.mas_equalTo(30);
    }];
    imaView.image=[UIImage imageNamed:@"纽带"];
    
    UIImageView *imaView12=[UIImageView new];
    [_scrollView addSubview:imaView12];
    [imaView12 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_mainW-80);
        make.top.mas_equalTo(_topView.mas_bottom).mas_equalTo(-20);
        make.height.mas_equalTo(55);
        make.width.mas_equalTo(30);
    }];
    imaView12.image=[UIImage imageNamed:@"纽带"];
    
    UIView *nameView=[UIView new];
    [_addView addSubview:nameView];
    [nameView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.mas_equalTo(0);
        make.height.mas_equalTo(50);
    }];
    
    UILabel *nameLabel=[UILabel new];
    [nameView addSubview: nameLabel];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(10);
    }];
    nameLabel.text=@"收件人";
    nameLabel.font=[UIFont systemFontOfSize:16];
    nameLabel.textColor=ColorWithRGB(49, 49, 49);
    
    UILabel *nameLabe2=[UILabel new];
    [nameView addSubview:nameLabe2];
    [nameLabe2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(-10);
        make.left.mas_equalTo(150);
    }];
    nameLabe2.text=[_dic objectForKey:@"document_ship_name"];
    nameLabe2.textColor=ColorWithRGB(70, 70, 70);
    nameLabe2.font=[UIFont systemFontOfSize:16];
    nameLabe2.textAlignment=NSTextAlignmentRight;
    
    UIView *xianView3=[UIView new];
    [_addView addSubview:xianView3];
    [xianView3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(0);
        make.height.mas_equalTo(1);
        make.top.mas_equalTo(nameView.mas_bottom);
    }];
    xianView3.backgroundColor=_LightGrey;
    
    
    UIView *phoneView=[UIView new];
    [_addView addSubview:phoneView];
    [phoneView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(xianView3.mas_bottom);
        make.height.mas_equalTo(50);
    }];
    
    UILabel *phoneLabel=[UILabel new];
    [phoneView addSubview: phoneLabel];
    [phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(10);
    }];
    phoneLabel.text=@"电话";
    phoneLabel.font=[UIFont systemFontOfSize:16];
    phoneLabel.textColor=ColorWithRGB(49, 49, 49);
    
    UILabel *phoneLabe2=[UILabel new];
    [phoneView addSubview:phoneLabe2];
    [phoneLabe2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(-10);
    }];
    phoneLabe2.text=[_dic objectForKey:@"document_ship_hpone"];
    phoneLabe2.textColor=ColorWithRGB(70, 70, 70);
    phoneLabe2.font=[UIFont systemFontOfSize:16];
    phoneLabe2.textAlignment=NSTextAlignmentRight;
    
    UIView *xianView2=[UIView new];
    [_addView addSubview:xianView2];
    [xianView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(0);
        make.height.mas_equalTo(1);
        make.top.mas_equalTo(phoneView.mas_bottom);
    }];
    xianView2.backgroundColor=_LightGrey;
    
    
    UIView *addView=[UIView new];
    [_addView addSubview:addView];
    [addView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(xianView2.mas_bottom);
        make.height.mas_equalTo(50);
    }];
    
    UILabel *addLabe=[UILabel new];
    [addView addSubview: addLabe];
    [addLabe mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(10);
    }];
    addLabe.text=@"收件地址";
    addLabe.font=[UIFont systemFontOfSize:16];
    addLabe.textColor=ColorWithRGB(49, 49, 49);
    
    UILabel *addLabe2=[UILabel new];
    [addView addSubview:addLabe2];
    [addLabe2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(addLabe);
        make.left.mas_equalTo(130);
    }];
    addLabe2.numberOfLines=0;
    addLabe2.text=[_dic objectForKey:@"document_ship_address"];
    addLabe2.textColor=ColorWithRGB(70, 70, 70);
    addLabe2.font=[UIFont systemFontOfSize:16];
    addLabe2.textAlignment=NSTextAlignmentRight;
    
    
    _LSView=[UIView new];
    [_scrollView addSubview:_LSView];
    [_LSView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(_topView);
        make.height.mas_equalTo(180);
        make.top.mas_equalTo(_addView.mas_bottom).mas_equalTo(20);
    }];
    _LSView.backgroundColor=[UIColor whiteColor];
    _LSView.layer.cornerRadius=3;
    
    UIView *xianView=[UIView new];
    [_LSView addSubview:xianView];
    [xianView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(3);
        make.height.mas_equalTo(20);
    }];
    xianView.backgroundColor=_backgroundColor;
    
    UILabel *woDeLabel=[UILabel new];
    [_LSView addSubview:woDeLabel];
    [woDeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(xianView);
        make.left.mas_equalTo(xianView.mas_right).mas_equalTo(10);
    }];
    woDeLabel.text=@"我的律师";
    woDeLabel.textColor=ColorWithRGB(49, 49, 49);
    woDeLabel.font=[UIFont systemFontOfSize:22];
    
    NSDictionary *lawyer_info=[_dic objectForKey:@"lawyer_info"];
    
    UIImageView *userImage=[UIImageView new];
    [_LSView addSubview:userImage];
    [userImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(woDeLabel.mas_bottom).mas_equalTo(25);
        make.width.height.mas_equalTo(70);
    }];
    userImage.layer.masksToBounds=YES;
    userImage.layer.cornerRadius=35;
    NSString *waiter_icon=[lawyer_info objectForKey:@"waiter_icon"];
    waiter_icon=[NSString stringWithFormat:@"%@%@",_addressUrl,waiter_icon];
    [userImage sd_setImageWithURL:[NSURL URLWithString:waiter_icon]];
    
    UILabel *nameLabel12=[UILabel new];
    [_LSView addSubview:nameLabel12];
    [nameLabel12 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(userImage.mas_top);
        make.left.mas_equalTo(userImage.mas_right).mas_equalTo(15);
    }];
    nameLabel12.textColor=ColorWithRGB(49, 49, 49);
    nameLabel12.text=[lawyer_info objectForKey:@"waiter_name"];
    nameLabel12.font=[UIFont systemFontOfSize:17];
    float width=0;
    
    NSString *wl_field_names=[lawyer_info objectForKey:@"wl_field_names"];
    if ([ZQTools charIsNil:wl_field_names]) {
        _scrollView.contentSize = CGSizeMake(0,860+size2.height);
        return;
    }
    NSArray *biaoQian=[wl_field_names componentsSeparatedByString:@","];
    int abc=biaoQian.count;
    if (biaoQian.count>2) {
        abc=2;
    }
    for (int i=0; i<abc; i++) {
        NSString *biaoStr=biaoQian[i];
        CGSize size=[ZQTools getNSStringWeight:biaoStr andViewWight:16 andFont:16 ];
        
        UILabel *label=[UILabel new];
        [_LSView addSubview:label];
        [label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(userImage.mas_right).mas_equalTo(15+width);
            make.height.mas_equalTo(20);
            make.width.mas_equalTo(size.width+16);
            make.bottom.mas_equalTo(userImage);
        }];
        label.text=biaoQian[i];
        label.font=[UIFont systemFontOfSize:16];
        label.textColor=ColorWithRGB(149, 149, 149);
        label.layer.cornerRadius=4;
        label.layer.borderColor=ColorWithRGB(149,149, 149).CGColor;
        label.layer.borderWidth=1;
        label.textAlignment=NSTextAlignmentCenter;
        width=width+size.width+30;
    }
    
    UIView *xianZaiView=[UIView new];
    [_LSView addSubview:xianZaiView];
    [xianZaiView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.width.mas_equalTo(100);
        make.centerY.mas_equalTo(0);
        make.height.mas_equalTo(100);
    }];
    xianZaiView.layer.borderColor=_LightGrey.CGColor;
    xianZaiView.layer.borderWidth=1;
    xianZaiView.userInteractionEnabled=YES;
    UITapGestureRecognizer *tapGesture12 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(xiazai)];
    [xianZaiView addGestureRecognizer:tapGesture12];
    
    UIImageView *xiaZai=[UIImageView new];
    [xianZaiView addSubview:xiaZai];
    [xiaZai mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(0);
        make.top.mas_equalTo(15);
        make.width.height.mas_equalTo(30);
    }];
    xiaZai.image=[UIImage imageNamed:@"下载文件"];
    
    UIView *xianView13=[UIView new];
    [xianZaiView addSubview:xianView13];
    [xianView13 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.bottom.mas_equalTo(-30);
        make.height.mas_equalTo(1);
    }];
    xianView13.backgroundColor=_LightGrey;
    
    UILabel *lable23=[UILabel new];
    [xianZaiView addSubview:lable23];
    [lable23 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(0);
        make.top.mas_equalTo(xianView13.mas_bottom).mas_equalTo(5);
    }];
    lable23.text=[NSString stringWithFormat:@"下载%@",[_dic objectForKey:@"document_dt_name"]];
    lable23.textColor=ColorWithRGB(149, 149, 149);
    lable23.font=[UIFont systemFontOfSize:15];
    
    _scrollView.contentSize = CGSizeMake(0,860+size2.height);
    
}

-(void)wanChengView{
    [_topView removeFromSuperview];
    [_LSView removeFromSuperview];
    [_addView removeFromSuperview];
    [_pingjiaView removeFromSuperview];
    
    _topView=[UIView new];
    [_scrollView addSubview:_topView];
    [_topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.width.mas_equalTo(_mainW-10);
        make.height.mas_equalTo(180);
        make.top.mas_equalTo(190);
    }];
    _topView.backgroundColor=[UIColor whiteColor];
    _topView.layer.cornerRadius=3;
    
    UIImageView *iamgeView=[UIImageView new];
    [_topView addSubview:iamgeView];
    [iamgeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(20);
        make.width.height.mas_equalTo(60);
    }];
    iamgeView.layer.cornerRadius=30;
    iamgeView.layer.masksToBounds=YES;
    NSString *news_cover=[_dic objectForKey:@"user_icon"];
    news_cover=[NSString stringWithFormat:@"%@%@",_addressUrl,news_cover];
    [iamgeView sd_setImageWithURL:[NSURL URLWithString:news_cover]];
    
    NSString *phoneStr=[_dic objectForKey:@"document_ship_name"];
    UILabel *label=[UILabel new];
    [_topView addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(iamgeView.mas_right).mas_equalTo(6);
        make.top.mas_equalTo(iamgeView);
        make.right.mas_equalTo(-120);
    }];
    label.text=phoneStr;
    label.textColor=ColorWithRGB(49, 49, 49);
    label.font=[UIFont systemFontOfSize:17];
    
    NSString *time=[_dic objectForKey:@"document_add_time_text"];
    UILabel *timeLabel=[UILabel new];
    [_topView addSubview:timeLabel];
    [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(label);
        make.bottom.mas_equalTo(iamgeView);
    }];
    timeLabel.text=time;
    timeLabel.font=[UIFont systemFontOfSize:14];
    timeLabel.textColor=ColorWithRGB(149, 149, 149);
    
    NSString *consult_ct_name=[_dic objectForKey:@"document_dt_name"];
    CGSize size=[ZQTools getNSStringWeight:consult_ct_name andViewWight:20 andFont:18];
    UILabel *ct_nameLabel=[UILabel new];
    [_topView addSubview:ct_nameLabel];
    [ct_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.height.mas_equalTo(30);
        make.centerY.mas_equalTo(label);
        make.width.mas_equalTo(size.width+14);
    }];
    ct_nameLabel.text=consult_ct_name;
    ct_nameLabel.font=[UIFont systemFontOfSize:16];
    ct_nameLabel.textColor=ColorWithRGB(76, 169, 221);
    [ct_nameLabel layoutIfNeeded];
    ct_nameLabel.textAlignment=NSTextAlignmentCenter;
    ct_nameLabel.layer.cornerRadius=4;
    ct_nameLabel.layer.borderWidth=1;
    ct_nameLabel.layer.borderColor=ColorWithRGB(76, 169, 221).CGColor;
    
    
    NSNumber *consult_money=[_dic objectForKey:@"document_money"];
    UILabel *moneyLabel=[UILabel new];
    [_topView addSubview:moneyLabel];
    [moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(timeLabel);
    }];
    moneyLabel.text=[NSString stringWithFormat:@"¥%@/份",consult_money];
    moneyLabel.textColor=[UIColor redColor];
    moneyLabel.font=[UIFont systemFontOfSize:14];
    
    NSString *document_content=[_dic objectForKey:@"document_content"];
    CGSize size2=[ZQTools getNSStringSize:document_content andViewWight:_mainW-30 andFont:16];
    
    UILabel *contentLabel=[UILabel new];
    [_topView addSubview:contentLabel];
    [contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(10);
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(timeLabel.mas_bottom).mas_equalTo(20);
    }];
    contentLabel.numberOfLines=3;
    contentLabel.text=document_content;
    contentLabel.textColor=ColorWithRGB(149, 149, 149);
    contentLabel.font=[UIFont systemFontOfSize:16];
    
    
    
    
    if (size2.height>65) {
        contentLabel.numberOfLines=2;
        UIImageView *imageView2=[UIImageView new];
        [_topView addSubview:imageView2];
        [imageView2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.mas_equalTo(0);
            make.bottom.mas_equalTo(-5);
            make.width.mas_equalTo(22);
            make.height.mas_equalTo(14);
        }];
        imageView2.image=[UIImage imageNamed:@"展开"];
//        imageView2.userInteractionEnabled=YES;
//        UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(wangChengView2)];
//        [imageView2 addGestureRecognizer:tapGesture];
        UIView *anView=[UIView new];
        [_topView addSubview:anView];
        [anView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.mas_equalTo(0);
            make.top.mas_equalTo(contentLabel);
        }];
        anView.userInteractionEnabled=YES;
        UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(wangChengView2)];
        [anView addGestureRecognizer:tapGesture];
    }
    
    
    
    _addView=[UIView new];
    [_scrollView addSubview:_addView];
    [_addView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(_topView);
        make.top.mas_equalTo(_topView.mas_bottom).mas_equalTo(20);
        make.height.mas_equalTo(190);
    }];
    _addView.backgroundColor=[UIColor whiteColor];
    _addView.layer.cornerRadius=4;
    
    UIImageView *imaView=[UIImageView new];
    [_scrollView addSubview:imaView];
    [imaView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(50);
        make.top.mas_equalTo(_topView.mas_bottom).mas_equalTo(-20);
        make.height.mas_equalTo(55);
        make.width.mas_equalTo(30);
    }];
    imaView.image=[UIImage imageNamed:@"纽带"];
    
    UIImageView *imaView12=[UIImageView new];
    [_scrollView addSubview:imaView12];
    [imaView12 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_mainW-80);
        make.top.mas_equalTo(_topView.mas_bottom).mas_equalTo(-20);
        make.height.mas_equalTo(55);
        make.width.mas_equalTo(30);
    }];
    imaView12.image=[UIImage imageNamed:@"纽带"];
    
    UIView *nameView=[UIView new];
    [_addView addSubview:nameView];
    [nameView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.mas_equalTo(0);
        make.height.mas_equalTo(50);
    }];
    
    UILabel *nameLabel=[UILabel new];
    [nameView addSubview: nameLabel];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(10);
    }];
    nameLabel.text=@"收件人";
    nameLabel.font=[UIFont systemFontOfSize:16];
    nameLabel.textColor=ColorWithRGB(49, 49, 49);
    
    UILabel *nameLabe2=[UILabel new];
    [nameView addSubview:nameLabe2];
    [nameLabe2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(-10);
        make.left.mas_equalTo(150);
    }];
    nameLabe2.text=[_dic objectForKey:@"document_ship_name"];
    nameLabe2.textColor=ColorWithRGB(70, 70, 70);
    nameLabe2.font=[UIFont systemFontOfSize:16];
    nameLabe2.textAlignment=NSTextAlignmentRight;
    
    UIView *xianView3=[UIView new];
    [_addView addSubview:xianView3];
    [xianView3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(0);
        make.height.mas_equalTo(1);
        make.top.mas_equalTo(nameView.mas_bottom);
    }];
    xianView3.backgroundColor=_LightGrey;
    
    
    UIView *phoneView=[UIView new];
    [_addView addSubview:phoneView];
    [phoneView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(xianView3.mas_bottom);
        make.height.mas_equalTo(50);
    }];
    
    UILabel *phoneLabel=[UILabel new];
    [phoneView addSubview: phoneLabel];
    [phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(10);
    }];
    phoneLabel.text=@"电话";
    phoneLabel.font=[UIFont systemFontOfSize:16];
    phoneLabel.textColor=ColorWithRGB(49, 49, 49);
    
    UILabel *phoneLabe2=[UILabel new];
    [phoneView addSubview:phoneLabe2];
    [phoneLabe2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(-10);
    }];
    phoneLabe2.text=[_dic objectForKey:@"document_ship_hpone"];
    phoneLabe2.textColor=ColorWithRGB(70, 70, 70);
    phoneLabe2.font=[UIFont systemFontOfSize:16];
    phoneLabe2.textAlignment=NSTextAlignmentRight;
    
    UIView *xianView2=[UIView new];
    [_addView addSubview:xianView2];
    [xianView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(0);
        make.height.mas_equalTo(1);
        make.top.mas_equalTo(phoneView.mas_bottom);
    }];
    xianView2.backgroundColor=_LightGrey;
    
    
    UIView *addView=[UIView new];
    [_addView addSubview:addView];
    [addView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(xianView2.mas_bottom);
        make.height.mas_equalTo(50);
    }];
    
    UILabel *addLabe=[UILabel new];
    [addView addSubview: addLabe];
    [addLabe mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(10);
    }];
    addLabe.text=@"收件地址";
    addLabe.font=[UIFont systemFontOfSize:16];
    addLabe.textColor=ColorWithRGB(49, 49, 49);
    
    UILabel *addLabe2=[UILabel new];
    [addView addSubview:addLabe2];
    [addLabe2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(addLabe);
        make.left.mas_equalTo(130);
    }];
    addLabe2.numberOfLines=0;
    addLabe2.text=[_dic objectForKey:@"document_ship_address"];
    addLabe2.textColor=ColorWithRGB(70, 70, 70);
    addLabe2.font=[UIFont systemFontOfSize:16];
    addLabe2.textAlignment=NSTextAlignmentRight;
    
    
    _LSView=[UIView new];
    [_scrollView addSubview:_LSView];
    [_LSView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(_topView);
        make.height.mas_equalTo(180);
        make.top.mas_equalTo(_addView.mas_bottom).mas_equalTo(25);
    }];
    _LSView.backgroundColor=[UIColor whiteColor];
    _LSView.layer.cornerRadius=3;
    
    
    
    UIView *xianView=[UIView new];
    [_LSView addSubview:xianView];
    [xianView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(3);
        make.height.mas_equalTo(20);
    }];
    xianView.backgroundColor=_backgroundColor;
    
    UILabel *woDeLabel=[UILabel new];
    [_LSView addSubview:woDeLabel];
    [woDeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(xianView);
        make.left.mas_equalTo(xianView.mas_right).mas_equalTo(10);
    }];
    woDeLabel.text=@"我的律师";
    woDeLabel.textColor=ColorWithRGB(49, 49, 49);
    woDeLabel.font=[UIFont systemFontOfSize:22];
    
    
    NSDictionary *lawyer_info=[_dic objectForKey:@"lawyer_info"];
    
    UIImageView *userImage=[UIImageView new];
    [_LSView addSubview:userImage];
    [userImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(woDeLabel.mas_bottom).mas_equalTo(25);
        make.width.height.mas_equalTo(70);
    }];
    userImage.layer.masksToBounds=YES;
    userImage.layer.cornerRadius=35;
    NSString *waiter_icon=[lawyer_info objectForKey:@"waiter_icon"];
    waiter_icon=[NSString stringWithFormat:@"%@%@",_addressUrl,waiter_icon];
    [userImage sd_setImageWithURL:[NSURL URLWithString:waiter_icon]];
    
    UILabel *nameLabel12=[UILabel new];
    [_LSView addSubview:nameLabel12];
    [nameLabel12 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(userImage.mas_top);
        make.left.mas_equalTo(userImage.mas_right).mas_equalTo(15);
    }];
    nameLabel12.textColor=ColorWithRGB(49, 49, 49);
    nameLabel12.text=[lawyer_info objectForKey:@"waiter_name"];
    nameLabel12.font=[UIFont systemFontOfSize:17];
    float width=0;
    
    NSString *wl_field_names=[lawyer_info objectForKey:@"wl_field_names"];
    if ([ZQTools charIsNil:wl_field_names]) {
        _scrollView.contentSize = CGSizeMake(0,1100);
        return;
    }
    NSArray *biaoQian=[wl_field_names componentsSeparatedByString:@","];
    int abc=biaoQian.count;
    if (biaoQian.count>2) {
        abc=2;
    }
    for (int i=0; i<abc; i++) {
        NSString *biaoStr=biaoQian[i];
        CGSize size=[ZQTools getNSStringWeight:biaoStr andViewWight:16 andFont:16 ];
        
        UILabel *label=[UILabel new];
        [_LSView addSubview:label];
        [label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(userImage.mas_right).mas_equalTo(15+width);
            make.height.mas_equalTo(20);
            make.width.mas_equalTo(size.width+16);
            make.bottom.mas_equalTo(userImage);
        }];
        label.text=biaoQian[i];
        label.font=[UIFont systemFontOfSize:16];
        label.textColor=ColorWithRGB(149, 149, 149);
        label.layer.cornerRadius=4;
        label.layer.borderColor=ColorWithRGB(149,149, 149).CGColor;
        label.layer.borderWidth=1;
        label.textAlignment=NSTextAlignmentCenter;
        width=width+size.width+30;
    }
    
    UIView *xianZaiView=[UIView new];
    [_LSView addSubview:xianZaiView];
    [xianZaiView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.width.mas_equalTo(100);
        make.centerY.mas_equalTo(0);
        make.height.mas_equalTo(100);
    }];
    xianZaiView.layer.borderColor=_LightGrey.CGColor;
    xianZaiView.layer.borderWidth=1;
    
    xianZaiView.userInteractionEnabled=YES;
    UITapGestureRecognizer *tapGesture12 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(xiazai)];
    [xianZaiView addGestureRecognizer:tapGesture12];
    
    UIImageView *xiaZai=[UIImageView new];
    [xianZaiView addSubview:xiaZai];
    [xiaZai mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(0);
        make.top.mas_equalTo(15);
        make.width.height.mas_equalTo(30);
    }];
    xiaZai.image=[UIImage imageNamed:@"下载文件"];
    
    UIView *xianView13=[UIView new];
    [xianZaiView addSubview:xianView13];
    [xianView13 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.bottom.mas_equalTo(-30);
        make.height.mas_equalTo(1);
    }];
    xianView13.backgroundColor=_LightGrey;
    
    UILabel *lable23=[UILabel new];
    [xianZaiView addSubview:lable23];
    [lable23 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(0);
        make.top.mas_equalTo(xianView13.mas_bottom).mas_equalTo(5);
    }];
    lable23.text=[NSString stringWithFormat:@"下载%@",[_dic objectForKey:@"document_dt_name"]];
    lable23.textColor=ColorWithRGB(149, 149, 149);
    lable23.font=[UIFont systemFontOfSize:15];
    
    
    NSString *evaluate_content=[_dic objectForKey:@"evaluate_content"];
    CGSize size3=[ZQTools getNSStringSize:evaluate_content andViewWight:_mainW-40 andFont:17];
    _pingjiaView=[UIView new];
    [_scrollView addSubview:_pingjiaView];
    [_pingjiaView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(_topView);
        make.height.mas_equalTo(80+size3.height);
        make.top.mas_equalTo(_LSView.mas_bottom).mas_equalTo(20);
    }];
    _pingjiaView.backgroundColor=[UIColor whiteColor];
    _pingjiaView.layer.cornerRadius=3;
    
    UIView *xianView12=[UIView new];
    [_pingjiaView addSubview:xianView12];
    [xianView12 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(3);
        make.height.mas_equalTo(20);
    }];
    xianView12.backgroundColor=_backgroundColor;
    
    UILabel *woDeLabel2=[UILabel new];
    [_pingjiaView addSubview:woDeLabel2];
    [woDeLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(xianView12);
        make.left.mas_equalTo(xianView12.mas_right).mas_equalTo(10);
    }];
    woDeLabel2.text=@"我的评价";
    woDeLabel2.textColor=ColorWithRGB(49, 49, 49);
    woDeLabel2.font=[UIFont systemFontOfSize:22];
    
    NSNumber *evaluate_score=[_dic objectForKey:@"evaluate_score"];
    int typeNum2=evaluate_score.doubleValue*10;
    int typeNum=typeNum2%10;
    int index=5-evaluate_score.floatValue;
    
    
    for (int i=0; i<5; i++) {
        UIImageView *xingImage=[UIImageView new];
        [_pingjiaView addSubview:xingImage];
        [xingImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.mas_equalTo(-10-25*i);
            make.height.width.mas_equalTo(20);
            make.centerY.mas_equalTo(woDeLabel2);
        }];
        
        if (typeNum>0) {
            if (i<index) {
                xingImage.image=[UIImage imageNamed:@"评分1"];
            }
            if (i==index) {
                xingImage.image=[UIImage imageNamed:@"评分3"];
            }
            if (i>index) {
                xingImage.image=[UIImage imageNamed:@"评分2"];
            }
        }
        else{
            if (i<index) {
                xingImage.image=[UIImage imageNamed:@"评分1"];
            }
            else{
                xingImage.image=[UIImage imageNamed:@"评分2"];
            }
        }
    }
    
    UILabel *pingFen=[UILabel new];
    [_pingjiaView addSubview:pingFen];
    [pingFen mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(woDeLabel2);
        make.right.mas_equalTo(-140);
    }];
    pingFen.text=@"评分:";
    pingFen.textColor=ColorWithRGB(149, 149, 149);
    pingFen.font=[UIFont systemFontOfSize:16];
    
    UILabel *lable12=[UILabel new];
    [_pingjiaView addSubview:lable12];
    [lable12 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(xianView2);
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(woDeLabel2.mas_bottom).mas_equalTo(20);
    }];
    lable12.textColor=ColorWithRGB(79, 79, 79);
    lable12.text=evaluate_content;
    lable12.font=[UIFont systemFontOfSize:17];
    lable12.numberOfLines=0;
    
    
    _scrollView.contentSize = CGSizeMake(0,900+size3.height);
    
}

-(void)wangChengView2{
    [_topView removeFromSuperview];
    [_LSView removeFromSuperview];
    [_addView removeFromSuperview];
    [_pingjiaView removeFromSuperview];
    
    NSString *document_content=[_dic objectForKey:@"document_content"];
    CGSize size2=[ZQTools getNSStringSize:document_content andViewWight:_mainW-30 andFont:16];
    
    _topView=[UIView new];
    [_scrollView addSubview:_topView];
    [_topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.width.mas_equalTo(_mainW-10);
        make.height.mas_equalTo(140+size2.height);
        make.top.mas_equalTo(190);
    }];
    _topView.backgroundColor=[UIColor whiteColor];
    _topView.layer.cornerRadius=3;
    
    UIImageView *iamgeView=[UIImageView new];
    [_topView addSubview:iamgeView];
    [iamgeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(20);
        make.width.height.mas_equalTo(60);
    }];
    iamgeView.layer.cornerRadius=30;
    iamgeView.layer.masksToBounds=YES;
    NSString *news_cover=[_dic objectForKey:@"user_icon"];
    news_cover=[NSString stringWithFormat:@"%@%@",_addressUrl,news_cover];
    [iamgeView sd_setImageWithURL:[NSURL URLWithString:news_cover]];
    
    NSString *phoneStr=[_dic objectForKey:@"document_ship_name"];
    UILabel *label=[UILabel new];
    [_topView addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(iamgeView.mas_right).mas_equalTo(6);
        make.top.mas_equalTo(iamgeView);
        make.right.mas_equalTo(-120);
    }];
    label.text=phoneStr;
    label.textColor=ColorWithRGB(49, 49, 49);
    label.font=[UIFont systemFontOfSize:17];
    
    NSString *time=[_dic objectForKey:@"document_add_time_text"];
    UILabel *timeLabel=[UILabel new];
    [_topView addSubview:timeLabel];
    [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(label);
        make.bottom.mas_equalTo(iamgeView);
    }];
    timeLabel.text=time;
    timeLabel.font=[UIFont systemFontOfSize:14];
    timeLabel.textColor=ColorWithRGB(149, 149, 149);
    
    NSString *consult_ct_name=[_dic objectForKey:@"document_dt_name"];
    CGSize size=[ZQTools getNSStringWeight:consult_ct_name andViewWight:20 andFont:18];
    UILabel *ct_nameLabel=[UILabel new];
    [_topView addSubview:ct_nameLabel];
    [ct_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.height.mas_equalTo(30);
        make.centerY.mas_equalTo(label);
        make.width.mas_equalTo(size.width+14);
    }];
    ct_nameLabel.text=consult_ct_name;
    ct_nameLabel.font=[UIFont systemFontOfSize:16];
    ct_nameLabel.textColor=ColorWithRGB(76, 169, 221);
    [ct_nameLabel layoutIfNeeded];
    ct_nameLabel.textAlignment=NSTextAlignmentCenter;
    ct_nameLabel.layer.cornerRadius=4;
    ct_nameLabel.layer.borderWidth=1;
    ct_nameLabel.layer.borderColor=ColorWithRGB(76, 169, 221).CGColor;
    
    
    NSNumber *consult_money=[_dic objectForKey:@"document_money"];
    UILabel *moneyLabel=[UILabel new];
    [_topView addSubview:moneyLabel];
    [moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(timeLabel);
    }];
    moneyLabel.text=[NSString stringWithFormat:@"¥%@/份",consult_money];
    moneyLabel.textColor=[UIColor redColor];
    moneyLabel.font=[UIFont systemFontOfSize:14];
    
    //    NSString *document_content=[_dic objectForKey:@"document_content"];
    
    
    UILabel *contentLabel=[UILabel new];
    [_topView addSubview:contentLabel];
    [contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(10);
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(timeLabel.mas_bottom).mas_equalTo(20);
    }];
    contentLabel.numberOfLines=0;
    contentLabel.text=document_content;
    contentLabel.textColor=ColorWithRGB(149, 149, 149);
    contentLabel.font=[UIFont systemFontOfSize:16];
    
  
    UIImageView *imageView2=[UIImageView new];
    [_topView addSubview:imageView2];
    [imageView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(0);
        make.bottom.mas_equalTo(-5);
        make.width.mas_equalTo(22);
        make.height.mas_equalTo(14);
    }];
    imageView2.image=[UIImage imageNamed:@"收起"];
//    imageView2.userInteractionEnabled=YES;
//    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(wanChengView)];
//    [imageView2 addGestureRecognizer:tapGesture];
    
    UIView *anView=[UIView new];
    [_topView addSubview:anView];
    [anView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.mas_equalTo(0);
        make.top.mas_equalTo(contentLabel);
    }];
    anView.userInteractionEnabled=YES;
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(wanChengView)];
    [anView addGestureRecognizer:tapGesture];
    
    
    
    _addView=[UIView new];
    [_scrollView addSubview:_addView];
    [_addView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(_topView);
        make.top.mas_equalTo(_topView.mas_bottom).mas_equalTo(20);
        make.height.mas_equalTo(190);
    }];
    _addView.backgroundColor=[UIColor whiteColor];
    _addView.layer.cornerRadius=4;
    
    UIImageView *imaView=[UIImageView new];
    [_scrollView addSubview:imaView];
    [imaView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(50);
        make.top.mas_equalTo(_topView.mas_bottom).mas_equalTo(-20);
        make.height.mas_equalTo(55);
        make.width.mas_equalTo(30);
    }];
    imaView.image=[UIImage imageNamed:@"纽带"];
    
    UIImageView *imaView12=[UIImageView new];
    [_scrollView addSubview:imaView12];
    [imaView12 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_mainW-80);
        make.top.mas_equalTo(_topView.mas_bottom).mas_equalTo(-20);
        make.height.mas_equalTo(55);
        make.width.mas_equalTo(30);
    }];
    imaView12.image=[UIImage imageNamed:@"纽带"];
    
    UIView *nameView=[UIView new];
    [_addView addSubview:nameView];
    [nameView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.mas_equalTo(0);
        make.height.mas_equalTo(50);
    }];
    
    UILabel *nameLabel=[UILabel new];
    [nameView addSubview: nameLabel];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(10);
    }];
    nameLabel.text=@"收件人";
    nameLabel.font=[UIFont systemFontOfSize:16];
    nameLabel.textColor=ColorWithRGB(49, 49, 49);
    
    UILabel *nameLabe2=[UILabel new];
    [nameView addSubview:nameLabe2];
    [nameLabe2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(-10);
        make.left.mas_equalTo(150);
    }];
    nameLabe2.text=[_dic objectForKey:@"document_ship_name"];
    nameLabe2.textColor=ColorWithRGB(70, 70, 70);
    nameLabe2.font=[UIFont systemFontOfSize:16];
    nameLabe2.textAlignment=NSTextAlignmentRight;
    
    UIView *xianView3=[UIView new];
    [_addView addSubview:xianView3];
    [xianView3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(0);
        make.height.mas_equalTo(1);
        make.top.mas_equalTo(nameView.mas_bottom);
    }];
    xianView3.backgroundColor=_LightGrey;
    
    
    UIView *phoneView=[UIView new];
    [_addView addSubview:phoneView];
    [phoneView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(xianView3.mas_bottom);
        make.height.mas_equalTo(50);
    }];
    
    UILabel *phoneLabel=[UILabel new];
    [phoneView addSubview: phoneLabel];
    [phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(10);
    }];
    phoneLabel.text=@"电话";
    phoneLabel.font=[UIFont systemFontOfSize:16];
    phoneLabel.textColor=ColorWithRGB(49, 49, 49);
    
    UILabel *phoneLabe2=[UILabel new];
    [phoneView addSubview:phoneLabe2];
    [phoneLabe2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(-10);
    }];
    phoneLabe2.text=[_dic objectForKey:@"document_ship_hpone"];
    phoneLabe2.textColor=ColorWithRGB(70, 70, 70);
    phoneLabe2.font=[UIFont systemFontOfSize:16];
    phoneLabe2.textAlignment=NSTextAlignmentRight;
    
    UIView *xianView2=[UIView new];
    [_addView addSubview:xianView2];
    [xianView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(0);
        make.height.mas_equalTo(1);
        make.top.mas_equalTo(phoneView.mas_bottom);
    }];
    xianView2.backgroundColor=_LightGrey;
    
    
    UIView *addView=[UIView new];
    [_addView addSubview:addView];
    [addView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(xianView2.mas_bottom);
        make.height.mas_equalTo(50);
    }];
    
    UILabel *addLabe=[UILabel new];
    [addView addSubview: addLabe];
    [addLabe mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(10);
    }];
    addLabe.text=@"收件地址";
    addLabe.font=[UIFont systemFontOfSize:16];
    addLabe.textColor=ColorWithRGB(49, 49, 49);
    
    UILabel *addLabe2=[UILabel new];
    [addView addSubview:addLabe2];
    [addLabe2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(addLabe);
        make.left.mas_equalTo(130);
    }];
    addLabe2.numberOfLines=0;
    addLabe2.text=[_dic objectForKey:@"document_ship_address"];
    addLabe2.textColor=ColorWithRGB(70, 70, 70);
    addLabe2.font=[UIFont systemFontOfSize:16];
    addLabe2.textAlignment=NSTextAlignmentRight;
    
    
    _LSView=[UIView new];
    [_scrollView addSubview:_LSView];
    [_LSView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(_topView);
        make.height.mas_equalTo(180);
        make.top.mas_equalTo(_addView.mas_bottom).mas_equalTo(20);
    }];
    _LSView.backgroundColor=[UIColor whiteColor];
    _LSView.layer.cornerRadius=3;
    
    UIView *xianView=[UIView new];
    [_LSView addSubview:xianView];
    [xianView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(3);
        make.height.mas_equalTo(20);
    }];
    xianView.backgroundColor=_backgroundColor;
    
    UILabel *woDeLabel=[UILabel new];
    [_LSView addSubview:woDeLabel];
    [woDeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(xianView);
        make.left.mas_equalTo(xianView.mas_right).mas_equalTo(10);
    }];
    woDeLabel.text=@"我的律师";
    woDeLabel.textColor=ColorWithRGB(49, 49, 49);
    woDeLabel.font=[UIFont systemFontOfSize:22];
    
    NSDictionary *lawyer_info=[_dic objectForKey:@"lawyer_info"];
    
    UIImageView *userImage=[UIImageView new];
    [_LSView addSubview:userImage];
    [userImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(woDeLabel.mas_bottom).mas_equalTo(25);
        make.width.height.mas_equalTo(70);
    }];
    userImage.layer.masksToBounds=YES;
    userImage.layer.cornerRadius=35;
    NSString *waiter_icon=[lawyer_info objectForKey:@"waiter_icon"];
    waiter_icon=[NSString stringWithFormat:@"%@%@",_addressUrl,waiter_icon];
    [userImage sd_setImageWithURL:[NSURL URLWithString:waiter_icon]];
    
    UILabel *nameLabel12=[UILabel new];
    [_LSView addSubview:nameLabel12];
    [nameLabel12 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(userImage.mas_top);
        make.left.mas_equalTo(userImage.mas_right).mas_equalTo(15);
    }];
    nameLabel12.textColor=ColorWithRGB(49, 49, 49);
    nameLabel12.text=[lawyer_info objectForKey:@"waiter_name"];
    nameLabel12.font=[UIFont systemFontOfSize:17];
    float width=0;
    
    NSString *wl_field_names=[lawyer_info objectForKey:@"wl_field_names"];
    if ([ZQTools charIsNil:wl_field_names]) {
        _scrollView.contentSize = CGSizeMake(0,1200);
        return;
    }
    NSArray *biaoQian=[wl_field_names componentsSeparatedByString:@","];
    int abc=biaoQian.count;
    if (biaoQian.count>2) {
        abc=2;
    }
    for (int i=0; i<abc; i++) {
        NSString *biaoStr=biaoQian[i];
        CGSize size=[ZQTools getNSStringWeight:biaoStr andViewWight:16 andFont:16 ];
        
        UILabel *label=[UILabel new];
        [_LSView addSubview:label];
        [label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(userImage.mas_right).mas_equalTo(15+width);
            make.height.mas_equalTo(20);
            make.width.mas_equalTo(size.width+16);
            make.bottom.mas_equalTo(userImage);
        }];
        label.text=biaoQian[i];
        label.font=[UIFont systemFontOfSize:16];
        label.textColor=ColorWithRGB(149, 149, 149);
        label.layer.cornerRadius=4;
        label.layer.borderColor=ColorWithRGB(149,149, 149).CGColor;
        label.layer.borderWidth=1;
        label.textAlignment=NSTextAlignmentCenter;
        width=width+size.width+30;
    }
    
    UIView *xianZaiView=[UIView new];
    [_LSView addSubview:xianZaiView];
    [xianZaiView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.width.mas_equalTo(100);
        make.centerY.mas_equalTo(0);
        make.height.mas_equalTo(100);
    }];
    xianZaiView.layer.borderColor=_LightGrey.CGColor;
    xianZaiView.layer.borderWidth=1;
    
    
    xianZaiView.userInteractionEnabled=YES;
    UITapGestureRecognizer *tapGesture12 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(xiazai)];
    [xianZaiView addGestureRecognizer:tapGesture12];
    
    UIImageView *xiaZai=[UIImageView new];
    [xianZaiView addSubview:xiaZai];
    [xiaZai mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(0);
        make.top.mas_equalTo(15);
        make.width.height.mas_equalTo(30);
    }];
    xiaZai.image=[UIImage imageNamed:@"下载文件"];
    
    UIView *xianView13=[UIView new];
    [xianZaiView addSubview:xianView13];
    [xianView13 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.bottom.mas_equalTo(-30);
        make.height.mas_equalTo(1);
    }];
    xianView13.backgroundColor=_LightGrey;
    
    UILabel *lable23=[UILabel new];
    [xianZaiView addSubview:lable23];
    [lable23 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(0);
        make.top.mas_equalTo(xianView13.mas_bottom).mas_equalTo(5);
    }];
    lable23.text=[NSString stringWithFormat:@"下载%@",[_dic objectForKey:@"document_dt_name"]];
    lable23.textColor=ColorWithRGB(149, 149, 149);
    lable23.font=[UIFont systemFontOfSize:15];
    
    
    NSString *evaluate_content=[_dic objectForKey:@"evaluate_content"];
    CGSize size3=[ZQTools getNSStringSize:evaluate_content andViewWight:_mainW-40 andFont:17];
    _pingjiaView=[UIView new];
    [_scrollView addSubview:_pingjiaView];
    [_pingjiaView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(_topView);
        make.height.mas_equalTo(80+size3.height);
        make.top.mas_equalTo(_LSView.mas_bottom).mas_equalTo(20);
    }];
    _pingjiaView.backgroundColor=[UIColor whiteColor];
    _pingjiaView.layer.cornerRadius=3;
    
    UIView *xianView12=[UIView new];
    [_pingjiaView addSubview:xianView12];
    [xianView12 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(3);
        make.height.mas_equalTo(20);
    }];
    xianView12.backgroundColor=_backgroundColor;
    
    UILabel *woDeLabel2=[UILabel new];
    [_pingjiaView addSubview:woDeLabel2];
    [woDeLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(xianView12);
        make.left.mas_equalTo(xianView12.mas_right).mas_equalTo(10);
    }];
    woDeLabel2.text=@"我的评价";
    woDeLabel2.textColor=ColorWithRGB(49, 49, 49);
    woDeLabel2.font=[UIFont systemFontOfSize:22];
    
    NSNumber *evaluate_score=[_dic objectForKey:@"evaluate_score"];
    int typeNum2=evaluate_score.doubleValue*10;
    int typeNum=typeNum2%10;
    int index=5-evaluate_score.floatValue;
    
    
    for (int i=0; i<5; i++) {
        UIImageView *xingImage=[UIImageView new];
        [_pingjiaView addSubview:xingImage];
        [xingImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.mas_equalTo(-10-25*i);
            make.height.width.mas_equalTo(20);
            make.centerY.mas_equalTo(woDeLabel2);
        }];
        
        if (typeNum>0) {
            if (i<index) {
                xingImage.image=[UIImage imageNamed:@"评分1"];
            }
            if (i==index) {
                xingImage.image=[UIImage imageNamed:@"评分3"];
            }
            if (i>index) {
                xingImage.image=[UIImage imageNamed:@"评分2"];
            }
        }
        else{
            if (i<index) {
                xingImage.image=[UIImage imageNamed:@"评分1"];
            }
            else{
                xingImage.image=[UIImage imageNamed:@"评分2"];
            }
        }
    }
    
    UILabel *pingFen=[UILabel new];
    [_pingjiaView addSubview:pingFen];
    [pingFen mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(woDeLabel2);
        make.right.mas_equalTo(-140);
    }];
    pingFen.text=@"评分:";
    pingFen.textColor=ColorWithRGB(149, 149, 149);
    pingFen.font=[UIFont systemFontOfSize:16];
    
    UILabel *lable12=[UILabel new];
    [_pingjiaView addSubview:lable12];
    [lable12 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(xianView2);
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(woDeLabel2.mas_bottom).mas_equalTo(20);
    }];
    lable12.textColor=ColorWithRGB(79, 79, 79);
    lable12.text=evaluate_content;
    lable12.font=[UIFont systemFontOfSize:17];
    
    _scrollView.contentSize = CGSizeMake(0,860+size3.height+size2.height);

    
}

-(IBAction)tiJiao:(id)sender{
    if (!_xieYi) {
        [ZQTools svpInfo:@"你还没有同意平台声明"];
        return;
    }
    NSString *ramekStr=_textView.text;
    if (_documentDic==nil) {
        [ZQTools svpInfo:@"请选择文书类型"];
        return;
    }
    if ([ramekStr isEqualToString:@"请详细输入你要写的文书需求，如案情经过、证据情况、以便律师更好地为您服务…"]||[ZQTools charIsNil:ramekStr]) {
        [ZQTools svpInfo:@"请详细输入你要写的文书需求，如案情经过、证据情况、以便律师更好地为您服务…"];
        return;
    }
    NSString *document_ship_name=_nameText.text;
    if ([ZQTools charIsNil:document_ship_name]) {
        [ZQTools svpInfo:@"请输入真实姓名"];
        return;
    }
    NSString *document_ship_hpone=_phneText.text;
    if ([ZQTools charIsNil:document_ship_hpone]) {
        [ZQTools svpInfo:@"请输入真实手机号"];
        return;
    }
    if (_addDic==nil) {
        [ZQTools svpInfo:@"请先选择地区"];
        return;
    }
    NSString *document_ship_address=_addText.text;
    if ([ZQTools charIsNil:document_ship_address]) {
        [ZQTools svpInfo:@"请输入详细地址"];
        return;
    }
    
    
    NSNumber *dt_price=[_documentDic objectForKey:@"dt_price"];
    if (dt_price.doubleValue==0) {
        
        NSDictionary *userDic = [NSKeyedUnarchiver unarchiveObjectWithFile:_userModelFile];
        NSString *token=[userDic objectForKey:@"token"];
        NSNumber *waiter_id1=[userDic objectForKey:@"user_id"];
        NSString *user_id=[NSString stringWithFormat:@"%@",waiter_id1];
        
        NSNumber *dt_id1=[_documentDic objectForKey:@"dt_id"];
        NSString *dt_id=[NSString stringWithFormat:@"%@",dt_id1];
        
        
        NSDictionary *dic=[NSDictionary dictionaryWithObjectsAndKeys:token,@"token",@"0",@"user_role",user_id,@"user_id",@"1",@"document_type",dt_id,@"dt_id",@"0",@"pay_type",ramekStr,@"document_content",document_ship_address,@"document_ship_address",document_ship_name,@"document_ship_name",document_ship_hpone,@"document_ship_hpone",@"0",@"is_integral", nil];
        [ZQTools AFNPostDataUrl:@"user/Document/send_document" Dict:dic andTableView:nil andViewController:self.viewController andSuccessBlock:^(id responseObject) {
            _document_id=[responseObject objectForKey:@"document_id"];
           
            [self pushTOOK];
     
        
        } anderrorBlock:nil  ];
    }
    else{
        document_ship_address=[NSString stringWithFormat:@"%@%@",_addLabel.text,_addText.text];
        
        PayView2Controller *pay=[[PayView2Controller alloc]init];
        pay.dic=_documentDic;
        pay.ramekStr=ramekStr;
        pay.document_ship_name=document_ship_name;
        pay.document_ship_hpone=document_ship_hpone;
        pay.document_ship_address=document_ship_address;
        pay.document_type=@"1";
        [ZQTools pushNextViewController:self.viewController andRootController:pay];
        
    }

}

-(void)pushTOOK{
    NSDictionary *dic=[NSDictionary dictionaryWithObjectsAndKeys:_document_id,@"document_id",@"个性服务",@"neixin", nil];
    OKViewController *okView=[[OKViewController alloc] init];
    okView.dic=dic;
    [ZQTools pushNextViewController:self.viewController andRootController:okView];
}

-(IBAction)pijiama:(id)sender{
    PingJiaViewController *pingJia=[PingJiaViewController new];
    pingJia.evaluate_services_id=[_dic objectForKey:@"document_id"];
    pingJia.evaluate_services_type=@1;
    pingJia.evaluate_waiter_id=[_dic objectForKey:@"assign_waiter_id"];
    [ZQTools pushNextViewController:self.viewController andRootController:pingJia];
}


-(void)SelectAdd:(UITapGestureRecognizer *)tap{
    selectRegionView *addView=[selectRegionView new];
    [self addSubview:addView];
    [addView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.bottom.mas_equalTo(0);
    }];
    addView.customSelectedBlock = ^ (NSDictionary *dic)
    {
        NSString *mergename=[dic objectForKey:@"mergename"];
        NSArray *nameArr=[mergename componentsSeparatedByString:@","];
        NSString *addStr=@"";
        for (int i=0;i< nameArr.count; i++) {
            addStr=[NSString stringWithFormat:@"%@%@",addStr,nameArr[i]];
        }
        _addDic=dic;
        _addLabel.text=addStr;
        _addLabel.textColor=ColorWithRGB(49, 49, 49);
        
    };
    addView.index2=3;
    [addView creatView];
    
}

-(void)textViewDidBeginEditing:(UITextView *)textView{
    if ([textView.text isEqualToString:@"请详细输入你要写的文书需求，如案情经过、证据情况、以便律师更好地为您服务…"]) {
        textView.text=@"";
    }
    textView.textColor=ColorWithRGB(49, 49, 49);
    
}
-(void)textViewDidEndEditing:(UITextView *)textView{
    if ([textView.text isEqualToString:@""]) {
        textView.text=@"请详细输入你要写的文书需求，如案情经过、证据情况、以便律师更好地为您服务…";
        textView.textColor=ColorWithRGB(149 , 149, 149);
    }
    else{
        textView.textColor=ColorWithRGB(49 , 59, 49);
    }
    
}

-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
    _numLabel.text=[NSString stringWithFormat:@"%ld/200",textView.text.length - range.length + text.length];
    if ([text isEqualToString:@"\n"]){ //判断输入的字是否是回车，即按下return
        
        [_textView resignFirstResponder];        //在这里做你响应return键的代码
        return NO; //这里返回NO，就代表return键值失效，即页面上按下return，不会出现换行，如果为yes，则输入页面会换行
    }
    if ([[[UITextInputMode currentInputMode]primaryLanguage] isEqualToString:@"emoji"]) {
        return NO;
    }
    if ((textView.text.length - range.length + text.length) > 200)
    {
        NSString *substring = [text substringToIndex:200 - (textView.text.length - range.length)];
        NSMutableString *lastString = [textView.text mutableCopy];
        [lastString replaceCharactersInRange:range withString:substring];
        textView.text = [lastString copy];
        return NO;
    }
    else
    {
        return YES;
    }
}
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString*)string{
    if ([[[UITextInputMode currentInputMode]primaryLanguage] isEqualToString:@"emoji"]) {
        return NO;
    }
    return YES;
}
-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [textField resignFirstResponder];
    return YES;
}
-(void)creatXieYe:(UITapGestureRecognizer *)tap{
    if (_xieYi) {
        _xieYi=NO;
        _xieYiImage.image=[UIImage imageNamed:@"否"];
    }else{
        _xieYi=YES;
        _xieYiImage.image=[UIImage imageNamed:@"是"];
    }
}


-(void)xiazai {
    
    
    
    NSString *str=[_dic objectForKey:@"sl_file"];
    NSString *cuo=[ZQTools NSDateToTimeCuo:[NSDate new]];
    
    NSString * time=[ZQTools changeTimeCuo:@"yyyy-MM-dd":cuo];
    NSString * time2=[ZQTools changeTimeCuo:@"yyyy-MM-dd-HH:mm:ss":cuo];
    
    NSMutableDictionary  *dic=[NSMutableDictionary dictionaryWithCapacity:0];
    
    // 要下载文件的url
    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@",_addressUrl,str]];
    
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    


    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    NSURLSessionDownloadTask *task = [manager downloadTaskWithRequest:request progress:^(NSProgress * _Nonnull downloadProgress) {
        
        double daxiao=downloadProgress.totalUnitCount/1024;
        [dic setObject:[NSString stringWithFormat:@"%.2fKB",daxiao] forKey:@"size"];
        
    } destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) {
     
        NSURL *documentsDirectoryURL = [[NSFileManager defaultManager] URLForDirectory:NSDocumentDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:NO error:nil];
        NSLog(@"file = %@",targetPath);
        [dic setObject:[NSString stringWithFormat:@"%@_%@",time2,[response suggestedFilename]] forKey:@"filePath"];
        return [documentsDirectoryURL URLByAppendingPathComponent:[NSString stringWithFormat:@"%@_%@",time2,[response suggestedFilename]]];
       
 

    } completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
        
        [MBProgressHUD hideHUDForView:self animated:YES];
        [dic setObject:[_dic objectForKey:@"document_dt_name"] forKey:@"title"]; 
        [dic setObject:time forKey:@"time"];
        
        [ZQTools svpInfo:@"下载成功，请在我的下载中查看"];
        NSArray *xiaArr = [NSKeyedUnarchiver unarchiveObjectWithFile:_xiaZai];
        
        NSMutableArray *typeArr=[NSMutableArray arrayWithArray:xiaArr];
        [typeArr addObject:dic];
        [NSKeyedArchiver archiveRootObject:typeArr toFile:_xiaZai];
       
     
    }];
    [task resume];//开始下载 要不然不会进行下载的
    
}
-(void)pushToXieyi:(UITapGestureRecognizer *)tap{
    WEBViewController *webView=[[WEBViewController alloc] init];
    webView.title=@"用户协议";
    webView.url=@"http://www.djiaoshou.com/index/index/user_register_agreement.html";
    [ZQTools pushNextViewController:self.viewController andRootController:webView];
}

@end
